explaingit

maximoarceci/relaydb

18TypeScriptAudience · developerComplexity · 3/5ActiveSetup · moderate

TLDR

Local dev tool that puts a TCP router in front of multiple Postgres containers. Your app keeps one connection string while you switch active databases and snapshot their state.

Mindmap

mindmap
  root((RelayDB))
    Inputs
      Docker compose
      Active environment pick
      Snapshot file
    Outputs
      Routed Postgres connection
      pg_dump snapshot
      SQL console results
    Use Cases
      Switch dev databases
      Restore teammate state
      Test a migration safely
    Tech Stack
      React
      TypeScript
      FastAPI
      Postgres
      Docker

Things people build with this

USE CASE 1

Keep one Postgres connection string in your app while flipping between feature-branch databases

USE CASE 2

Restore a teammate's pg_dump snapshot to reproduce a bug locally

USE CASE 3

Take a snapshot before a migration so you can roll back cleanly

USE CASE 4

Run quick SQL from a web console against any managed environment

Tech stack

TypeScriptReactFastAPIPythonPostgreSQLDocker

Getting it running

Difficulty · moderate Time to first run · 30min

Needs Docker plus port 5432 free on the host, and there is no auth so it must be kept on localhost or a trusted network.

In plain English

RelayDB is a developer tool that makes working with PostgreSQL on a local machine less painful for a team. The pitch is that everyone's application always connects to the same fixed address, postgresql://postgres:postgres@localhost:5432/app, and RelayDB sits behind that address and quietly switches which actual database is on the other end. It is meant for development only, not as a production database service or an admin panel. The core machinery is a TCP router that listens on the standard PostgreSQL port and forwards connections to whichever environment is currently marked active. Each environment is a real postgres:16 Docker container with its own isolated Docker volume, all attached to a shared private network so the managed containers do not need to expose ports on the host. From the web UI or the API the developer can create, start, stop, delete, or pick the active environment; when the active target is changed RelayDB closes existing connections so the app reconnects into the new database. Snapshots are the second big feature. A snapshot is produced with pg_dump and stored in a dedicated relaydb_snapshots volume, separate from any individual database, so deleting an environment does not wipe out its frozen states. Snapshots can be listed globally and restored with pg_restore into any managed environment, not just the one they came from. The README walks through three workflows this enables: reproducing a teammate's bug by restoring their snapshot, testing a migration with a safe rollback point, and switching between feature branches that each need their own data without changing the app's connection string. The UI also exposes a SQL console that runs statements against the selected container and returns columns, rows, row count, command status, and database errors, which the author positions as a quick way to inspect or set up an environment without leaving the dashboard. The stack is React, TypeScript, Vite, Tailwind and Zustand on the frontend, FastAPI with the Docker SDK for Python and psycopg on the backend, an asyncio TCP router as the data plane, and Docker Compose to run everything. Getting started is docker compose up --build, with a fallback environment variable if the host already uses port 5432. The README lists the API endpoints for environments, SQL execution, and snapshots, and is explicit about what is not implemented yet: no auth, no RBAC, no cloud storage, no Kubernetes, no branching, and no realtime replication.

Copy-paste prompts

Prompt 1
Bring RelayDB up with docker compose and walk me through creating two environments and switching the active one
Prompt 2
Use RelayDB to snapshot my current dev database, then restore it into a fresh environment
Prompt 3
Wire my Node app to RelayDB at localhost 5432 and switch databases without restarting the app
Prompt 4
Add basic API key auth to the RelayDB FastAPI backend so teammates on the same LAN cannot wipe data
Prompt 5
Extend RelayDB to support a second pinned port for read-only access to a snapshot
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.