Skip to content

feat: PostgreSQL support via DATABASE_URL env variable #11

@cokehill

Description

@cokehill

Summary

SQLite is perfect for self-hosted single-instance deployments, but teams deploying to
Railway/Render/Fly.io with horizontal scaling need PostgreSQL.

Acceptance criteria

  • If DATABASE_URL env var is set, use pg (node-postgres) instead of better-sqlite3
  • DB abstraction layer in src/db/database.js detects which driver to use
  • Migrations run on both SQLite and Postgres (use raw SQL, not an ORM)
  • All queries work unchanged on both backends
  • docker-compose.yml gains an optional postgres service profile
  • README documents DATABASE_URL format

Notes

Keep better-sqlite3 as the default — SQLite requires zero config.
Consider a lightweight adapter interface: { prepare, exec } for SQLite vs { query } for Postgres.
Only add pg as a dependency (not pg-native).

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatabaseDB layer and migrationsScalabilityScale and performanceenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions