Deploy InstantDB
Realtime database that syncs queries straight to the browser
dashboard
Just deployed
server
Just deployed
/app/resources/config
Just deployed
/var/lib/postgresql/data
instant-storage
Bucket
Just deployed
Deploy and Host InstantDB on Railway
InstantDB is an open-source realtime database that syncs straight to the browser. Write a query in your React, Vue or vanilla JavaScript app and Instant keeps the result live: every client watching that data updates the moment anyone writes, with optimistic updates, offline reads, presence and cursors handled for you. It bundles what a team would otherwise assemble by hand — a relational store, a permissions language, magic-code and OAuth auth, and file storage — behind one SDK. Instant Cloud shuts down in August 2027, so self-hosting is now the supported way to run it.
Deploy InstantDB on Railway and the whole stack is wired together on the first click. The server service runs the Clojure sync engine that owns the API, the websocket and the storage endpoints. The dashboard service runs the Next.js admin UI for creating apps, browsing data and editing permissions. The postgres service is a PostgreSQL 17 build with pg_hint_plan and logical replication enabled, which is how the engine tails changes and pushes them to clients. A bucket named instant-storage holds uploads. Both public services get an HTTPS domain and the dashboard is handed the API URL at container start, so self-hosting Instant needs no reverse proxy and no DNS work.

Getting Started with InstantDB on Railway
Open the dashboard service's URL and you land on a sign-in screen asking for an email address. Instant has no default password: it emails a six-digit code, and with no mail provider configured it prints that code to the server service log instead. Enter your address, open that service's Deploy Logs in Railway, find the boxed INSTANT DASHBOARD LOGIN CODE block and paste the code back. Set INSTANT_SUPERUSER_EMAIL to the same address first — that account manages deployment-wide settings, including who may sign up. Then click New app and name it: the Home tab shows the app ID, the admin token and a command that scaffolds a project pointed at your deployment. Add a row in the Explorer and query it live in the Sandbox to prove the deployment healthy end to end; uploading a file confirms the bucket too.

About Hosting InstantDB
Instant sits in the same slot as Firebase or Supabase, but its data model is triples rather than tables, which is what lets a client subscribe to arbitrary nested queries and have them kept fresh. The SDK holds a local store, applies your write immediately and reconciles over a websocket. Teams self-host it to keep user data in their own infrastructure and to avoid per-seat cloud pricing.
- Realtime queries with optimistic writes, offline reads and reconciliation
- A permissions language evaluated server-side, testable in the Sandbox
- Built-in auth: magic codes, Google OAuth, guest sessions, a
$usersnamespace - File storage with presigned uploads, exposed as a
$filesnamespace - Presence, cursors and typing indicators as first-class primitives
- Admin SDK and REST endpoints for server-side reads, writes and user management
The architecture is deliberately small: server is stateless apart from one generated keyset on its volume, postgres holds every app, namespace, triple and user, and the bucket holds bytes only. Browsers reach the server over HTTPS and upgrade to a websocket for live queries.
Why Deploy InstantDB on Railway
Railway removes the fiddly parts of the official Docker Compose setup:
- Three services, their volumes and a bucket provisioned in one click
- Logical replication and
pg_hint_planalready enabled on the database - HTTPS domains issued automatically, with the dashboard pointed at the API
- Managed object storage instead of running your own MinIO
- Health checks watching the engine's own status endpoint
- Vertical scaling and metrics without touching a server
Common Use Cases
- Migrating off Instant Cloud before the 2027 shutdown, keeping the same SDK and schema
- Collaborative apps — documents, whiteboards, kanban, chat — where presence and live queries are the product
- Internal tools needing auth, permissions and a real database without a bespoke backend
- Prototypes and AI-generated apps needing a backend before the first prompt finishes
Dependencies for InstantDB
ghcr.io/instantdb/server:latest— the sync engine, API, websocket and storage endpointsghcr.io/instantdb/dashboard:latest— the Next.js admin dashboardghcr.io/instantdb/postgresql:postgresql-17-pg-hint-plan— PostgreSQL 17 with the planner-hint extensioninstant-storage— a Railway object-storage bucket for uploaded files
A stock managed PostgreSQL will not work: the engine reads the write-ahead log over logical replication, so the database needs wal_level=logical, replication slots and pg_hint_plan preloaded. That is why the template ships InstantDB's own PostgreSQL image.
Environment Variables Reference
| Variable | Service | Purpose |
|---|---|---|
INSTANT_BACKEND_URL | server, dashboard | Public API origin, handed to the browser |
INSTANT_DASHBOARD_URL | server | Public dashboard origin, used in invite links |
INSTANT_SUPERUSER_EMAIL | server | Operator account for deployment-wide settings |
DATABASE_URL | server | Private PostgreSQL connection string |
CONNECTION_POOL_SIZE | server | Connections per instance; keep under max_connections |
JAVA_OPTS | server | JVM heap and processor-count limits |
S3_ENDPOINT, S3_PUBLIC_ENDPOINT, S3_BUCKET | server | Object storage for the $files namespace |
RESEND_TOKEN, POSTMARK_TOKEN, SENDGRID_TOKEN | server | Optional; emails login codes |
INSTANT_DASHBOARD_GOOGLE_OAUTH_CLIENT_ID | server | Optional; adds Google sign-in to the dashboard |
Deployment Dependencies
- Source: github.com/instantdb/instant (Apache 2.0)
- Docs: instantdb.com/docs/self-hosting
- SDK:
@instantdb/react,@instantdb/core,@instantdb/adminon npm - Runtime: JVM 26, Node 22, PostgreSQL 17
Hardware Requirements for Self-Hosting InstantDB
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU across all services | 4+ vCPU |
| RAM | 2 GB total | 8 GB |
| Storage | 5 GB database volume | 20 GB+, sized to your data |
| Runtime | Docker, PostgreSQL 17 with logical replication | Same, plus object storage |
The JVM engine is the memory-hungry component. Give it a ceiling with JAVA_OPTS rather than letting it size itself from the host, and cap its processor count so the HTTP thread pools match the CPU you allocated.
Self-Hosting InstantDB with Docker
The repository ships a Compose file under self-hosting/. Clone it, copy the example environment file and bring the stack up:
git clone https://github.com/instantdb/instant.git
cd instant/self-hosting
cp .env.example .env
docker compose up -d
Point a client at your own deployment by overriding the API URL when you create the SDK instance. In JavaScript:
import { init } from '@instantdb/react';
const db = init({
appId: 'YOUR_APP_ID',
apiURI: 'https://your-server-domain',
websocketURI: 'wss://your-server-domain/runtime/session',
});
How Much Does InstantDB Cost to Self-Host?
InstantDB is open source under Apache 2.0 with no paid edition, seat limits or feature gates — the self-hosted build is the same code the hosted product ran. There is nothing to buy. On Railway you pay only for the compute, memory, volume and storage the three services use, which for a small app is a few dollars a month.
FAQ
What is InstantDB? An open-source realtime database that syncs data to the browser. You subscribe to a query with its SDK and every connected client stays current automatically, with auth, permissions and file storage included.
What does this Railway template deploy? Three services and a bucket: the sync engine, the admin dashboard, a PostgreSQL 17 database configured for logical replication, and object storage for uploads. The engine and the dashboard each get a public HTTPS domain.
How do I log in to the self-hosted InstantDB dashboard for the first time? There is no default password. Enter your email on the sign-in screen, then read the six-digit code from the server service's logs. Add a Resend, Postmark or SendGrid token later to have codes delivered by email.
Why does the template include its own PostgreSQL instead of a managed database?
The engine tails the write-ahead log over logical replication and needs the pg_hint_plan extension. Those are server-level settings a managed database does not expose.
Can I migrate an app from Instant Cloud to this deployment? Yes. The team published a migration guide alongside the shutdown announcement. Your schema, permissions and client code carry over; you change the API URL your SDK points at.
How do I connect my frontend to a self-hosted InstantDB?
Pass apiURI and websocketURI to init() alongside your app ID, using the server service's public domain. The dashboard's Home tab prints a command that scaffolds a project already configured for it.
Template Content
dashboard
ghcr.io/instantdb/dashboard:latestinstant-storage
Bucket
