Quick start
This guide will walk you through setting up S2 Lite locally and creating your first basin and stream. You’ll be reading and writing records in just a few minutes.Prerequisites
- The S2 CLI installed (installation guide)
- A terminal or command prompt
Start S2 Lite
S2 Lite is embedded in the CLI and provides a fully functional S2 API that runs in-memory. Start it with:For production use, you can configure S2 Lite to use object storage like AWS S3 or Tigris. See the S2 Lite documentation for details.
Configure the CLI
In a new terminal, set these environment variables to point the CLI at your local S2 Lite instance:Verify the server is ready
Check that S2 Lite is running:Create a basin
Create your first basin with automatic stream creation enabled:quickstart that automatically creates streams when you append to or read from them.
1
Create a basin
The basin is created with automatic stream creation enabled
2
Append records
Write your first records to a stream
3
Read records
Read the records back from the stream
Write records to a stream
Append some records to a new stream:--create-stream-on-append.
Read records from a stream
Read all records from the stream:Try real-time streaming
Open two terminals to see real-time streaming in action. Terminal 1 - Start a live reader:Benchmark performance
Test S2 Lite’s performance with the built-in benchmark:Next steps with the SDK
Now that you have S2 Lite running, try using the SDK to build applications.Rust SDK example
Add the SDK to your project:Remember to export the environment variables pointing to your S2 Lite instance before running SDK examples.
Using S2 cloud
To use the managed S2 service instead of S2 Lite:1
Sign up
Create an account at s2.dev
2
Generate access token
Generate an access token from the dashboard
3
Configure CLI
Set your access token:Remove the endpoint overrides (or unset them):
4
Create resources
Use the same commands to create basins and streams
Troubleshooting
Common issues
Connection refused- Check that
s2 liteis running - Verify the port matches your
S2_ACCOUNT_ENDPOINTandS2_BASIN_ENDPOINT
- Make sure you created the basin with
--create-stream-on-appendor--create-stream-on-read - Or manually create the stream with
s2 create-stream
- Re-export the environment variables in each new terminal session
- Or add them to your shell profile (
~/.bashrc,~/.zshrc, etc.)
Learn more
- Installation guide - Install other SDKs and tools
- Concepts - Understand basins, streams, and records
- API reference - Explore the full REST API
- SDK documentation - Rust SDK reference