feat(pwa): move app.logicsrc.com from Turso/libSQL to Postgres via @profullstack/libsql-pg (#218)

Production reads DATABASE_URL (postgres://) through @profullstack/libsql-pg,
which keeps the @libsql/client surface; no query changed. A missing,
non-Postgres or leftover libsql:// URL fails at boot in production. Dev and
tests keep libSQL (file:/:memory:) as a devDependency. Postgres migrations in
src/migrations-pg/ (converted with libsql-pg convert-schema, same file names
so the copied _migrations ledger matches); migrate.mjs picks the dialect.
Tests run against Postgres with PWA_TEST_DATABASE_URL.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-09-25 09:28:40 -07:00 • committed by GitHub
parent c535aaa32c
commit 4ac750e65b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 507 additions and 29 deletions

View file

@ -36,9 +36,12 @@ export const config = {
rpName: "LogicSRC",
sessionSecret: process.env.SESSION_SECRET || "dev-insecure-secret-change-me",
db: {
// Turso (libSQL) in prod; a local file for dev. TURSO_* takes precedence.
url: process.env.TURSO_DATABASE_URL || process.env.DATABASE_URL || "file:./data/local.db",
authToken: process.env.TURSO_AUTH_TOKEN || process.env.DATABASE_AUTH_TOKEN || undefined,
// Postgres (postgres://) in production, through @profullstack/libsql-pg; a
// local libSQL file or `:memory:` for dev and tests. DATABASE_URL wins. A
// leftover TURSO_DATABASE_URL is still read so that db.mjs can refuse it
// with a message that names it, rather than silently opening a file db.
url: process.env.DATABASE_URL || process.env.TURSO_DATABASE_URL || "file:./data/local.db",
authToken: process.env.DATABASE_AUTH_TOKEN || process.env.TURSO_AUTH_TOKEN || undefined,
},
resend: {
apiKey: process.env.RESEND_API_KEY || "",