-
Notifications
You must be signed in to change notification settings - Fork 68
Backend: Add PostgreSQL support as alternative to SQLite #284
Copy link
Copy link
Closed
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarea: backendBackend API (Node/Express)Backend API (Node/Express)difficulty: hardLarger or subtle changesLarger or subtle changesinfraDeployment, docker, runtimeDeployment, docker, runtimemainnetCritical for mainnet launchCritical for mainnet launchperformancePerf and scalabilityPerf and scalability
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarea: backendBackend API (Node/Express)Backend API (Node/Express)difficulty: hardLarger or subtle changesLarger or subtle changesinfraDeployment, docker, runtimeDeployment, docker, runtimemainnetCritical for mainnet launchCritical for mainnet launchperformancePerf and scalabilityPerf and scalability
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
The backend uses SQLite via the DAL abstraction (
backend/src/dal/). SQLite is great for development and single-instance setups but is unsuitable for production deployments that require horizontal scaling, concurrent writes at volume, or managed cloud database hosting. The DAL abstraction already separates repository interfaces from implementations — adding a PostgreSQL backend is the natural next step.Problem
Acceptance Criteria
backend/src/dal/pgCampaignRepository.jsandbackend/src/dal/pgAuditLogRepository.jsimplementing the same interfaces as the SQLite versionspg(node-postgres) or@databases/pgas the database clientDATABASE_URLenv variable; when present and prefixed withpostgres://, use the PG implementationbackend/src/db/migrations/compatible with both SQLite and PostgreSQL schemasbackend/.env.examplewith PostgreSQL configuration examplescompose.yamlto add an optionalpostgresservice profile (like the existingredisprofile)backend/README.mdReferences
backend/src/dal/index.js— DAL factorybackend/src/dal/sqliteCampaignRepository.js— reference implementationcompose.yaml— Docker Compose for adding postgres servicebackend/.env.example