Deploy Valkey
Open-source Redis-compatible in-memory database with auth and persistence.
Valkey
Just deployed
/data
Deploy and Host Valkey on Railway
Valkey is a high-performance, open-source in-memory data store, born as a community-driven fork of Redis and backed by the Linux Foundation. It's fully compatible with the Redis protocol and clients, making it a drop-in replacement for caching, session storage, queues, and real-time data workloads, with sub-millisecond latency.
About Hosting Valkey
Hosting Valkey means running a persistent, password-protected in-memory database that your applications can reach quickly and securely. This template deploys the official valkey/valkey Docker image with authentication enabled out of the box: a random 32-character password is generated automatically on deploy, and the server starts with the port and credentials already wired up. Your other Railway services connect over the private network using the provided VALKEY_URL, while an optional TCP proxy exposes a public URL for external access. Attach a volume at /data to persist your data across redeployments. No manual configuration, no Dockerfiles, and no server maintenance required.
Common Use Cases
- Caching layer: Speed up APIs and web apps by caching database queries, rendered pages, and expensive computations.
- Session and rate-limit storage: Store user sessions, tokens, and request counters with built-in key expiration.
- Job queues and background workers: Power queue libraries like BullMQ, Celery, or Sidekiq with fast, reliable queues.
- Real-time features: Build leaderboards, pub/sub messaging, live notifications, and counters.
Dependencies for Valkey Hosting
- Valkey official Docker image (
valkey/valkey) - A Railway Volume mounted at
/data(recommended for data persistence)
Implementation Details
The template pre-configures these environment variables:
| Variable | Description |
|---|---|
VALKEY_DATABASE_URL | Private connection URL for services inside your Railway project |
VALKEY_PUBLIC_DATABASE_URL | Public connection URL via TCP proxy |
VALKEY_PASSWORD | Auto-generated 32-character password |
VALKEY_PORT | Server port (default 6379) |
The service starts with the following command, which passes the port and password to the official image's entrypoint:
/bin/sh -c "exec docker-entrypoint.sh valkey-server --port ${VALKEY_PORT} --requirepass ${VALKEY_PASSWORD}"
Connect from your app using any Redis-compatible client. Example with Node.js:
import { createClient } from "redis";
const client = createClient({ url: process.env.VALKEY_URL });
await client.connect();
await client.set("hello", "Valkey on Railway");
console.log(await client.get("hello"));
Test the connection from the CLI:
valkey-cli -u "$VALKEY_PUBLIC_URL" ping
# PONG
Why Deploy Valkey on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Valkey on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Valkey
valkey/valkey