Passkin

Your users in your database

Status: built (2026-10-05) — Neon N1 of NEON.md. Tests: apps/auth-broker/tests/database-sync.test.ts, packages/sync-engine/tests.

A developer connects their own Postgres — Neon first, Supabase, RDS, anything on the public internet. Passkin creates a small passkin schema in it and keeps a copy of the project's people, organizations and memberships there, one-way and near-real-time. The developer's own tables can reference passkin.users(id), join to it, and write row-level-security policies against passkin.memberships; Passkin never reads their tables.

Dashboard → Data, or PUT /v1/manage/projects/:pid/database with { "connection_string": "postgresql://…?sslmode=require" }.

The schema (version 1)

passkin.users          id, email, email_verified, first_name, last_name, name, avatar_url, phone, external_id,
                       public_metadata, banned, created_at, updated_at, last_sign_in_at, synced_at
passkin.identities     user_id → users, method                      (google, github, email, passkey, …)
passkin.organizations  id, slug, name, logo_url, metadata, created_at, updated_at, synced_at
passkin.memberships    organization_id → organizations, user_id → users, role, permissions, created_at, synced_at
passkin.sync_state     schema_version, project_id, last_synced_at

Only what a product needs to join its tables to its people. Private metadata, unsafe metadata, passwords, passkeys, tokens and sessions never leave Passkin. public_metadata is copied because the developer already reads it everywhere.

How it stays current — and why a slow database cannot hurt a sign-in

  1. Something changes in Passkin (a person signs up, is banned, changes, is deleted; an organization or a membership changes; people are imported). The event it already produces for webhooks also writes one pending row to an outbox: "look at this user again". One row per thing, however many times it changes before the worker looks.
  2. A worker takes the due rows and reads the current state from Passkin and writes that — an upsert, or a delete if it is gone. It copies state, not events, so a retry, a duplicate or an out-of-order delivery cannot leave the copy wrong. A membership also makes sure its organization and user are there first (the tables reference each other).
  3. It runs right after the change in the background, from the scheduled call that already drives webhook retries (POST /internal/cron/webhooks), and on request. Nothing here is in the sign-in path: a slow, broken or full customer database delays only its own copy.
  4. A failure is retried after 30 s, 2 min, 10 min, 1 h, 6 h; after that it is a dead letter the developer sees on the Data page (with the database's own error) and can put back with one click.
  5. A user signing in again only moves last_sign_in_at: at most one update per person every ten minutes.

Deleting is real: a person deleted in Passkin is deleted in the connected database too, with their identities and memberships. Resync (dashboard or POST …/database/resync) queues everything again and checks the other side for rows Passkin no longer has, so any divergence — a row someone deleted there, a leftover — is repaired without reasoning about what went wrong. The dashboard shows how many users are here and there and whether they agree.

Connecting safely

  • A role of its own. The Test button reaches the database without changing it and says whether Passkin could create its schema; if not, it shows the SQL for a role limited to the passkin schema. Passkin writes only to that schema (a test checks that tables outside it are untouched).
  • TLS required (sslmode=require or stronger), except a database on this machine in development. Only a few harmless parameters are accepted in the string (no host=, no options=).
  • The inside is not reachable. The host is resolved and any answer in a private, loopback or link-local range (including cloud metadata addresses) is refused; the connection is made to the address that was checked, so a name that resolves differently a moment later is no way around it.
  • The string is stored encrypted under the master key, is never returned, logged or written to the audit log (the log keeps the host, the engine and the database name), and is used only by the worker.
  • Connecting is limited to ten attempts an hour per project.
  • Disconnect stops the copying and keeps what is there; ask for drop_schema and the schema is removed too.

Neon Data API and row-level security

The Data page also shows the JWKS URL, issuer and audience to paste into Neon's "other provider" setting (or Supabase's third-party auth), so Neon verifies Passkin's tokens: auth.user_id() is the token's sub, which is passkin.users.id. With the memberships in the same database, a policy can say "members of this organization may read these rows" without trusting a claim:

CREATE POLICY orders_org ON public.orders FOR SELECT
  USING (EXISTS (SELECT 1 FROM passkin.memberships m WHERE m.organization_id = orders.organization_id AND m.user_id = auth.user_id()));

Owner-only, organization-shared and admin-only templates are on the page.

Not built yet

Neon's own API (usage, branches, backups, a managed database per project — N2–N4); a users explorer and schema browser in the dashboard; other engines than Postgres; copying Passkin's sessions or audit log; two-way sync (the copy is for reading — write to Passkin through its API); per-project column mapping into the developer's own users table (the old design); the Neon partner OAuth ("connect Neon" in one click).

Ready to try it?

Create a project — the dashboard fills these snippets in with your own keys.

Open the dashboard