Skip to content

[Backend] Configure TypeOrmModule.forRoot from environment variables #137

Description

@Muhammadcodes112

Description

Wire the database connection using the env vars documented in astre_server/.env.example, rather than hardcoded config.

Where

astre_server/src/app.module.ts (or a separate astre_server/src/db.config.ts helper, following whatever pattern feels cleanest — a small helper function is fine)

What to implement

Read DATABASE_URL if set; otherwise fall back to individual DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME vars. Pass the result to TypeOrmModule.forRoot({ ..., synchronize: false, entities: [...], migrations: [...] })synchronize must stay false, see Hints.

Acceptance Criteria

  • Connecting works with either DATABASE_URL alone, or the individual DB_* vars
  • synchronize: false is explicitly set (never implicitly rely on the default)
  • All Phase 1 entities (Pool, Donation, SyncState) are registered

Hints

  • synchronize: false is deliberate, not an oversight — the schema is only ever changed by running a migration (see the migration-writing issues). Setting this true, even temporarily while developing, risks the database silently drifting from what the migrations describe.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendNestJS API (astre_server)good first issueGood for newcomersphase-1Core donation-loop MVP (1/3 scope), builds on mvp-phase-1 branch

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions