# pgStore

> pgStore: My own little Neon. Isolated Postgres databases with branches, a SQL editor and agent access, on one box.

URL: https://sayanbiswas.in/p/pgstore/

- status · live
- started · 2026
- updated · dec 2026
- stack · go, postgres, pgbouncer, pgvector, react, tanstack, shadcn/ui, caddy, cloudflare tunnel, mcp
- site · [pgstore.vantible.com](https://pgstore.vantible.com)

![The pgStore overview: eight projects, 125 MB of storage, 13 of 100 connections, throughput with a trend, a 24-hour connections chart, the projects table and recent activity.](https://sayanbiswas.in/_astro/pgstore-overview-light.BEQU1PCg_ZLfKoA.webp) 

Every side project wants a Postgres database. Managed providers are lovely until you have a dozen small apps, each wanting its own branch of someone else’s free tier. So I built the part of Neon I actually use: click a button, get an isolated database and a connection that works from Vercel.

pgStore started life as basin, a small control plane on a VPS. It has since been rebuilt in Go and moved onto a mini PC behind a Cloudflare Tunnel, and it grew up along the way: branches, a SQL editor, a table browser, vector search, accounts for friends and scoped access for AI agents. It runs at [pgstore.vantible.com](https://pgstore.vantible.com).

The screenshots use synthetic projects and traffic. The hostname is real, nothing else is.

## how it fits together

*Diagram:* Everything enters through one HTTPS hostname. A Cloudflare Tunnel carries it to Caddy on loopback. The dashboard and API go to pgstore; apps open Postgres sessions over a WebSocket that pgstore hands to a loopback PgBouncer. Postgres and PgBouncer only listen on localhost.

- **One cluster, hard walls.** A project is a login role plus the databases it owns. `CONNECT` is revoked from everyone else and the role carries a `CONNECTION LIMIT`, so projects can’t see or crowd each other.
- **No open database port.** Postgres and PgBouncer only listen on localhost. Apps reach them over a WebSocket on the same hostname as the dashboard, using Neon’s serverless driver. pgStore forwards each session to a fixed loopback PgBouncer, which checks the project’s own SCRAM credentials. `psql` works too, bridged through `websocat`.
- **Branches are copies.** A branch is `CREATE DATABASE … TEMPLATE` of its parent: schema, data, extensions and vector settings. Copying needs the parent idle for a moment, so its clients are briefly disconnected.
- **Least privilege for the control plane.** The service connects as a role with `CREATEDB` and `CREATEROLE`, not as a superuser, and opens a project’s data through that project’s own login.

## the console

![The storefront project: storage, connections against its limit, throughput and database count in one strip, a 24-hour transactions chart, its three databases and recent activity.](https://sayanbiswas.in/_astro/pgstore-project-light.CeF-6O3P_ZWApjp.webp) 

*One project: a stat strip, activity for the selected database, its branches and what happened to it. Synthetic data.*

The console was redesigned in December along the lines of Linear, PlanetScale and Stripe: neutral surfaces, one berry accent kept for actions and the main chart line, stat strips instead of floating cards, and a database picker in the header that every page follows.

![The connect sheet for storefront: tabs for .env, Node.js and psql, the DATABASE_URL and PGSTORE_WEBSOCKET_URL values, the host, WSS port, database and role, and the gateway URL.](https://sayanbiswas.in/_astro/pgstore-connect-light.BFicqIiQ_2imRVn.webp) 

*Connect opens a sheet with the gateway settings, a Node.js example and a psql bridge. Synthetic data.*

Branching is a button. Each branch is a full copy of its parent, under the same role and password, so a preview deployment or a risky migration gets its own database in seconds and can be reset from its parent.

![The databases page: main, a dev branch and a preview_pr_42 branch nested under dev, with parent, storage, connections and age.](https://sayanbiswas.in/_astro/pgstore-databases-light.WT_qoOvQ_Z17s5y4.webp) 

*Databases and branches as a tree. Synthetic data.*

![The SQL editor with a revenue-by-country query and its five-row result, with column types, timing and CSV export.](https://sayanbiswas.in/_astro/pgstore-sql-light.CCqi5Ltl_1b7gx6.webp) 

*The SQL editor runs as the project's role, with history, a read-only switch and CSV export. Synthetic data.*

Project settings are rows you can scan: the description and connection limit, password rotation and `pg_dump` backups, and a danger zone. The password is shown once at creation; pgStore keeps only the SCRAM verifier, so a lost password means a rotation, never a lookup.

![Project settings: a general section with name, description and connection limit, credentials and backups with rotate and download, a danger zone with delete, and the project's activity log.](https://sayanbiswas.in/_astro/pgstore-settings-light.-6mBLvba_Z260ahM.webp) 

*Settings, credentials and the activity log. Synthetic data.*

Everything is a keystroke away in the command palette.

![The command palette open over the projects page, listing all eight projects with their descriptions.](https://sayanbiswas.in/_astro/pgstore-palette-light.Bri5z2IV_ZUCotU.webp) 

*⌘K for projects, pages and actions. Synthetic data.*

On a phone, navigation is a floating tab bar with its own search button, and every dialog becomes a drawer you can swipe away.

![Three phone screens: the overview with a floating tab bar and search button, the storefront project, and its More drawer listing project sections, workspace pages and projects.](https://sayanbiswas.in/_astro/pgstore-mobile-light.D-_yZyTw_rboYA.webp) 

*The overview, a project, and the More drawer on a phone. Synthetic data.*

## for agents and friends

**Agent access** hands an MCP client a named token for one project, valid for 1 to 90 days. A read grant can list databases and tables, read rows and search vectors; a write grant can also run SQL and create databases, including test clones. Only a hash of the token is stored, and revoking it stops the next request.

**Vectors** use pgvector. Pick the embedding model your app uses when you create a database and pgStore sets up an `embeddings` table with the right dimensions and an HNSW index for the model’s metric, then lets you search by example from the console.

**Accounts** let me give a friend their own corner. Admins manage their own projects, a super admin sees everything, and sign-ins are rate limited with bcrypt-hashed passwords.

## under the hood

The service is a single Go binary: pgx and sqlx for Postgres, Huma for the API and its OpenAPI document, Goose for catalog migrations, sqlc for the metrics sampler that reads `pg_stat_database` once a minute, and the official Go MCP SDK. The console is Vite, React and TanStack Router, Query and Table on shadcn/ui, with a client generated from the OpenAPI spec.

Releases are versioned folders on the box with a symlink pointing at the live one, so shipping is a copy and a switch, and rolling back is one `ln`. I wrote up the Postgres and PgBouncer decisions underneath, and the one Postgres 16 permission change that bit me, in [a blog post](https://sayanbiswas.in/blog/pgstore-managed-postgres-on-one-box).

## log

- 2026-12-02 · phones: floating tab bar, a search button, and drawers (vaul) for More and every dialog.
- 2026-12-02 · console redesign: neutral surfaces, stat strips, a connect sheet, Stripe-style settings.
- 2026-11-28 · WebSocket gateway behind a Cloudflare Tunnel, on a mini PC; Postgres no longer exposed.
- 2026-11-28 · rebuilt in Go and renamed pgStore: accounts, agent access over MCP, vector search.
- 2026-11-27 · branches, SQL editor, table browser and monitoring (as basin).
- 2026-10-10 · black and silver redesign (as basin): project pages, connection rings, live charts, command palette.
- 2026-07-04 · provisioning playbook tested end to end on a throwaway VM.
- 2026-07-03 · push-to-deploy over a forced-command SSH key; one-click backups.
- 2026-07-03 · first version as basin: create, rotate and delete, behind TLS PgBouncer.
