Purpose: Library cabinet for LLM agents building new Briven Auth. These are reference docs from SuperTokens — borrow good product/architecture ideas. Briven Auth stays Briven-branded, multi-tenant on Briven Doltgres, not a raw SuperTokens install.
Date filed: 2026-07-22 URL count: 492 unique
Before any Auth change (magic link, OTP, OAuth/Konnos, sessions, MFA, passkeys, FDI, IdP, SSO, providers, secrets, allowed domains, enable/disable Auth, or any code under Auth surfaces):
Also written into project root CLAUDE.md. Skipping this step is a rule violation, not a style preference.
pk_briven_auth_, no inventing Clerk).AI_DOCS/dolt-reference/). Also read AI_DOCS/dolt-reference/00-doltgres-truth.md.| SuperTokens docs say | Briven Auth must do |
|---|---|
| Supabase | Briven Doltgres per project |
| MySQL migrate | Migrate / store on Doltgres |
| Self-host Core | Hosted by Briven platform (users do not run Core) |
| App domain backend SDK | First-party auth on app + Briven Auth control plane |
| Dashboard | Yellow Briven Auth sidebar section (sub-dashboard) |
Purpose: Library cabinet for EVERY Briven build that touches SQL, Auth, backups, or Postgres-family compatibility.
Source: (1) flndrn official www.doltgres.com list (PRIMARY, complete set below) + (2) URLs from AI_DOCS/dolt-reference/* (local notes + often dolthub.com MySQL-Dolt siblings) (already in this repo). Agents must open these — do not guess.
HARD RULE: On any Doltgres / Postgres-wire error (including SuperTokens Core or any tool built for Postgres), search this section + AI_DOCS/dolt-reference/00-doltgres-truth.md before changing architecture. Never quit after one SQL error without reading these and notifying flndrn with options.
AI_DOCS/dolt-reference/00-doltgres-truth.md — authoritative DoltGres facts (Postgres-flavored)AI_DOCS/dolt-reference/01-intro-install.mdAI_DOCS/dolt-reference/02-use-cases.mdAI_DOCS/dolt-reference/03-concepts-git.mdAI_DOCS/dolt-reference/04-concepts-sql.mdAI_DOCS/dolt-reference/05-rdbms-dolthub.mdAI_DOCS/dolt-reference/06-sqlref-server.mdAI_DOCS/dolt-reference/07-sqlref-version-control.mdDOLTGRES-FIRST.md — Briven hard product ruleFiled from flndrn full URL list (2026-07-22). These are the real DoltGres product docs (Postgres-flavored). Prefer these over dolthub.com MySQL-Dolt pages when they overlap. Count: 51 URLs
https://www.doltgres.com/docs/reference/benchmarks/latency/
AI_DOCS/dolt-reference/00-doltgres-truth.md and the matching URL group above.pg driver). Missing feature ≠ abandon the product.Rule: Keep our Doltgres version in step with upstream. When DoltHub ships a new
dolthub/doltgresql release, we evaluate and (after testing) move our pinned version
along — because their releases carry the lock/concurrency/panic fixes we depend on.
Do this as a manual, tested process — NOT an auto-updater/Watchtower/host-side poller
(forbidden by infra/CLAUDE.md).
infra/dokploy/compose.dokploy.yml — the doltgres,
dolt-backup, and init services all use image: dolthub/doltgresql:<version> (a readable
version tag, not an opaque @sha256 digest, so the version is visible + bumpable).
Current pin: 0.57.2 (upgraded from 0.56.6 on 2026-08-01).docker run the new image on a fresh
volume (fresh-init), cp -a a copy of the live db dirs in, start, and confirm it reads
them (select count(*) from information_schema.tables … on briven_control). Doltgres
upgrades are forward-compatible in practice (0.56.6 → 0.57.2 read cleanly, no migration).behavior.auto_gc_behavior.enable: false in config.yaml (see incident below)./code compose, swap the prepared data
into the live volume, and recreate via scripts/safe-redeploy-service.sh doltgres.select dolt_version()), all DBs serve, API boots, then watch it hold
under load past the previous failure window before calling it done.Symptom: api.briven.tech returns Traefik 404 page not found on every route (incl.
/health); api container crash-loops stuck at applying migrations…; Doltgres is "healthy"
but serves zero databases — every psql connect (even postgres/template1) returns
FATAL: "database X does not exist", and trace logs show database "briven_control" is locked
by another dolt process … holds an exclusive write lock even with the server stopped and no
other process alive. Recurs within 4–50 minutes of normal API write load. All 22 DB dirs
on disk are intact (.dolt/noms valid) — not data loss.
Root cause: Doltgres 0.56.6 (our pin) has a database-lock defect under concurrent
write load. Upstream 0.57.1 shipped a lock-subsystem rewrite (LockSubsystem.TryLock)
and 0.56.9 fixed an INSERT panic (a regression since 0.56.5 — our 0.56.6 was affected).
0.56.6 also predates the auto_gc_behavior config, and 0.57.1 enabled auto-GC by default
(auto-GC "breaks all open connections"). NOT related to issue #2600 (that's app-level advisory
locks). Verified against release notes, not guessed.
The SOLID fix (on Doltgres, per DOLTGRES-FIRST — no Postgres):
0.56.6 → 0.57.2 (validated: 0.57.2 reads 0.56.6 data unchanged; briven_control
51 tables, briven_engine 23 — no migration).config.yaml: under behavior: add
auto_gc_behavior:\n enable: false (only valid on 0.57.x — 0.56.6 rejects the key with
field auto_gc_behavior not found, which is how you know you must upgrade first).Emergency triage (temporary, if you must restore before upgrading): a cp -a of each DB
dir to fresh inodes clears the stale lock and the server serves again — but on 0.56.6 it
re-jams under load within minutes-to-an-hour. It is NOT a fix; only the version upgrade is.
Recipe that reliably serves: fresh-init an EMPTY volume (entrypoint), then copy the DB dirs
in — a populated-but-uninitialized data-dir will NOT serve; and never leave *.dirty/rollback
DB copies inside the data-dir (Doltgres enumerates every subdir and one bad copy aborts the
whole multi-DB load).
Gotchas hit during the fix: (a) the dolt-backup job's dolt_backup(sync-url) writes to
every live DB and accelerates the lock/GC failure — keep it disabled until its method is
reworked to cold snapshots; (b) a stray docker run --rm doltgres can linger and hold the
volume lock — always docker rm -f; (c) load secrets into a shell var from docker inspect …
DOLTGRES_PASSWORD / .env.prod — never literal in a command.
A controlled live test on France settled the open question of whether 0.57.2 survives a restart/host-reboot:
docker restart the healthy live doltgres → all 24 databases re-served within 8s,
briven_control reachable, held steady across 64s of polling.docker restart the api → healthy + public /health+/ready = 200 within 8s, routing
intact (/v1/ → 404, not 5xx).Conclusion: Doltgres 0.57.2 is reboot-safe. The earlier "a plain docker restart does
NOT recover it" note was wrong-cause — those restarts were of a container already poisoned
by a full-deploy recreate under load; restarting an already-broken container can't help, but
restarting a healthy one is clean (which is all a host reboot does).
The ONE remaining outage trigger is a full Dokploy deploy (compose up --build
--remove-orphans) that recreates doltgres while it's under write load (re-runs the entrypoint
on a live-but-busy data dir). So "100% production solid" = two locks, not a code change:
briven-france compose
autoDeploy: false) — a git push can no longer auto-rebuild.scripts/safe-redeploy-service.sh <svc>, never recreates
doltgres). Full compose.deploy only for the "red-panel → one green" rule (gotcha #13).Proven-good under every normal op: load (373k-req + 10-writer stress, 0 errors), restart/
reboot (above), dolt_backup+restart (throwaway). Data is never lost — a not-serving state
keeps every DB dir intact on the _doltgres_data volume; recovery recipe is the fresh-init+copy
above. (Note: the Dokploy panel may show composeStatus: error from the 08-01 failed run — that
is a stale badge, not live health; the running stack is healthy.)