elitan replaces Supabase with Better Auth and Kysely

elitan dropped Supabase as both the auth and data layer, substituting Better Auth backed directly by Postgres and Kysely as the typed query builder. The result is a stack that runs against any Postgres database without a Supabase project.

infrastructuresecurity

The main commit (+3208/-1374, 47 files) deletes backend/src/lib/supabase.ts and replaces it with backend/src/lib/auth.ts (Better Auth init) plus a backend/src/lib/db.ts exposing Kysely over a typed schema. Every backend route - chat, documents, projects, tabular, user, workflows - is rewritten to use Kysely rather than the Supabase PostgREST client. schema.sql sheds its Supabase RLS references in favor of a plain Postgres schema.

Frontend auth is now handled by AuthContext.tsx, auth-client.ts, and a new 66-line auth-session.ts. The three env vars for Supabase (SUPABASE_URL, SUPABASE_SECRET_KEY, NEXT_PUBLIC_SUPABASE_*) are gone; replacements are BETTER_AUTH_SECRET, BETTER_AUTH_URL, and DATABASE_URL.

Two cleanup commits followed the same day. 42d38bda renames KyselyCompatQuery to KyselyResultQuery in db.ts. 8923b301 renames the exported Kysely instance from kysely to db. Small, but they show the author settling on naming conventions after landing a large mechanical rewrite.

Validation was build-plus-smoke-start; the PR merged ten minutes after it opened. A 1374-line deletion across manually translated SQL is a place where filter conditions can quietly disappear, so the route files are worth a careful read if you pull this.

So what Worth pulling only if you want to drop the Supabase dependency entirely. The RLS guarantees Supabase enforced at the database layer are now the application's responsibility - check `access.ts` and `middleware/auth.ts` carefully. Cherry-picking individual routes is not realistic given how thorough the rewrite is.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from elitan/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
dce1302e refactor(db): replace supabase with better auth and kysely Johan Eliasson 2026-05-15 ↗ GitHub
42d38bda refactor(db): clarify kysely query adapter Johan Eliasson 2026-05-15 ↗ GitHub
8923b301 refactor(db): rename kysely instance to db Johan Eliasson 2026-05-15 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-448.md from inside the repo you want the changes in.

⬇ Download capture-thread-448.md