Redis for the API, locally
The API caches prices, balances and transactions in Redis, and uses it for rate limiting. It boots
without Redis, with a warning. For a local Redis, use the Docker Compose file in apps/api.
On this page
Running it
From apps/api:
docker compose up -d redisdocker compose --profile tools up -ddocker compose downdocker compose logs -f redisdocker compose exec redis redis-cliFrom the repository root, add -f apps/api/docker-compose.yml.
Redis listens on localhost:6379, with append-only persistence. Redis Commander, a web UI for
browsing the data, is at http://localhost:8081 when started with the tools profile.
Pointing the API at it
The API reads REDIS_URL first, then REDIS_HOST, REDIS_PORT (defaults localhost and 6379)
and REDIS_PASSWORD. apps/api/env.example sets REDIS_URL to a sample cloud address, so for
local Redis remove that line from your .env or set it to redis://localhost:6379.
Data
Redis data lives in the redis-data Docker volume and survives docker compose down. To remove it:
docker compose down -vHosted Redis
A deployed API uses a hosted Redis, set with REDIS_URL. To run the local container with a
password, change its command in docker-compose.yml:
command: redis-server --appendonly yes --requirepass <password>and set the same value as REDIS_PASSWORD in the API's .env.