---
title: "Deploy SpacetimeDB | (Just Updated) Realtime Database, Logins Survive Redeploys"
description: "SpacetimeDB realtime database. Logins and data survive redeploys"
category: "Storage"
url: https://railway.com/deploy/spacetimedb-or-just-updated-realtime-dat
---

# Deploy SpacetimeDB | (Just Updated) Realtime Database, Logins Survive Redeploys

SpacetimeDB realtime database. Logins and data survive redeploys

**[Deploy SpacetimeDB | (Just Updated) Realtime Database, Logins Survive Redeploys on Railway](https://railway.com/template/spacetimedb-or-just-updated-realtime-dat)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/spacetimedb-or-just-updated-realtime-dat/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Storage

## Template content

### spacetimedb

- **Image:** clockworklabs/spacetime:v2.10.2@sha256:acf3210403559f731e222fb77042aac32429d7ea77a4858ffa68bd459383069d
- **Start command:** `/bin/sh -c 'set -e; export HOME=/data/home; D=/data/stdb; mkdir -p "$D" "$HOME"; echo "[railway] data-dir=$D keys=$HOME/.config/spacetime uid=$(id -u) writable=$(test -w /data && echo yes || echo no) port=$PORT"; exec spacetime start --listen-addr "0.0.0.0:$PORT" --data-dir "$D" --non-interactive'`
- **Health check:** /v1/ping
- **Public domain:** Yes

## Documentation

# Deploy and Host SpacetimeDB on Railway

SpacetimeDB is a relational database with a built-in server runtime. Clients connect straight to the
database, and your server-side logic (modules written in Rust, C# or TypeScript) runs inside it, so a
real-time game, chat or collaborative app needs no separate backend.

This template runs SpacetimeDB 2.10 as a single service from a digest-pinned official image, with the
HTTP and WebSocket API on your Railway domain and a Railway volume holding both the database and the
server's login-signing keys.

## About Hosting SpacetimeDB

- **Logins survive a redeploy.** The stock image keeps the key that signs identity tokens in the
  container's home directory, outside any volume. After every redeploy the server generates a new
  key, and every token it issued before answers `Invalid token: InvalidSignature`. This template
  moves the keys and the database onto the volume, so identities, tokens and published modules
  carry across redeploys.
- **Reachable over HTTPS and WebSocket** on the generated Railway domain, with a health check on
  `/v1/ping`.
- **Pinned to a release.** The image is pinned by digest, so a redeploy never changes the server
  version underneath your modules.
- **Open by default.** Any client that can reach the URL can create an identity and publish a
  module. Keep the domain private if the database should not be public, or put your own
  authentication in front of it.

## Common Use Cases

- Real-time multiplayer game backends
- Chat and presence services
- Collaborative apps that share live state between clients
- Prototyping a database-plus-server app without a separate backend

## Dependencies for SpacetimeDB Hosting

- One Railway volume for the database and keys (created by the template)

### Deployment Dependencies

- SpacetimeDB documentation: https://spacetimedb.com/docs
- Official image: https://hub.docker.com/r/clockworklabs/spacetime

### Implementation Details

Point the SpacetimeDB CLI at your deployment and publish a module:

```sh
spacetime server add --url https:// railway --default
spacetime publish --server railway my-database
```

The start command logs the data directory, key directory and whether the volume is writable on every
boot.

## Why Deploy SpacetimeDB 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 SpacetimeDB 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.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/spacetimedb-or-just-updated-realtime-dat
