Skip to main content
Swytch Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Quickstart: Local

Install Swytch, start a local cache, and read and write data with a Redis client. You need a free port 6379 and either a native installation or Docker.

1. Install Swytch

Choose one installation method.

Homebrew: macOS or Linux

brew tap swytchdb/tap
brew install swytch

curl: macOS or Linux

curl -fsSL https://getswytch.com/scripts/install.sh | sh

The installer prints the installation directory. It normally uses ~/.local/bin. If that directory is not on your PATH, add it for this terminal:

export PATH="$HOME/.local/bin:$PATH"

Add the same line to your shell configuration to keep it in future terminals.

PowerShell: Windows

iwr -useb https://getswytch.com/scripts/install.ps1 | iex

By default, the installer places swytch.exe in %LOCALAPPDATA%\Programs\swytch. Add it to the current terminal’s PATH:

$env:Path = "$env:LOCALAPPDATA\Programs\swytch;$env:Path"

For future terminals, add that directory to your user PATH in Windows environment settings.

Docker

docker pull ghcr.io/swytchdb/swytch:latest

The latest image is convenient for this walkthrough. Pin a release for deployment. You can also download binaries, checksums, and signatures from Swytch releases.

2. Start the cache

For a native installation, run:

swytch redis --bind 127.0.0.1 --maxmemory 256mb

Leave this terminal running. Swytch accepts Redis connections at 127.0.0.1:6379.

For Docker, run this instead:

docker run --rm --name swytch-quickstart -p 127.0.0.1:6379:6379 ghcr.io/swytchdb/swytch:latest redis --bind 0.0.0.0 --maxmemory 256mb

The server listens on the container interface; the published port is available only on your host’s loopback address.

3. Connect a client

Open another terminal. If you already have redis-cli, connect with:

redis-cli -h 127.0.0.1 -p 6379

To install the client on macOS with Homebrew:

brew install redis

On Debian or Ubuntu:

sudo apt-get update
sudo apt-get install redis-tools

You only need the client; Swytch is already serving the Redis endpoint.

If you chose the Docker server, you can use a client container on any supported host, including Windows:

docker run --rm -it --network container:swytch-quickstart redis:7.4-alpine redis-cli -h 127.0.0.1 -p 6379

This client shares the Swytch container’s network. It does not start another server. For a native Windows installation, use an existing Redis-compatible client at 127.0.0.1:6379, or use the Docker server and client commands above to follow the interactive examples.

4. Use it

At the redis-cli prompt, check the connection and store a value:

PING
SET greeting "hello from Swytch"
GET greeting

Expect PONG, then OK, then "hello from Swytch".

Give a cached value an expiration:

SET session:demo active EX 60
TTL session:demo

TTL reports the remaining lifetime in seconds. After the minute expires, GET session:demo returns nil.

Try a counter and a list:

INCR visits
INCR visits
RPUSH jobs resize:42 resize:43
LPOP jobs

On a fresh instance, the counter replies are 1 and 2. The list push returns 2, and the pop returns "resize:42". Your application’s Redis client can use the same endpoint and commands. See Redis data structures for more examples.

5. Stop the cache

Enter QUIT to leave the client, then press Ctrl+C in the server terminal. The Docker server container is removed automatically because it was started with --rm.

This instance keeps its data in memory. Stopping it discards the data; the next start is empty. Choose tiering when state needs to survive its holders.

Where to go next