Description
app.module.ts hardcodes SQLite as the database with synchronize: true. SQLite files are wiped on every deployment on ephemeral hosting platforms (Render, Railway, Fly.io). ByteChain Academy cannot deploy to production until switched to environment-based PostgreSQL.
Background
Current config: type: 'sqlite', database: 'database.sqlite', synchronize: true
- SQLite file lost on every restart on cloud hosting
synchronize: true in production risks dropping columns on deploy
- No connection pooling, no SSL support
Required additions to .env.example
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=your_password
DB_DATABASE=bytechain_academy
DB_SSL=false
NODE_ENV=development
Implementation Guide
Replace TypeOrmModule.forRoot with TypeOrmModule.forRootAsync using ConfigService. Read all DB settings from env vars. Set synchronize: true only when NODE_ENV !== 'production'. Enable SSL when DB_SSL === 'true' with rejectUnauthorized: false. Update e2e tests to use SQLite in-memory override so CI does not need a PostgreSQL instance.
Acceptance Criteria
Complexity: High - 200 points
Join: https://t.me/ByteChainAcademy | Contact: contact@nexacore.org
Description
app.module.tshardcodes SQLite as the database withsynchronize: true. SQLite files are wiped on every deployment on ephemeral hosting platforms (Render, Railway, Fly.io). ByteChain Academy cannot deploy to production until switched to environment-based PostgreSQL.Background
Current config:
type: 'sqlite', database: 'database.sqlite', synchronize: truesynchronize: truein production risks dropping columns on deployRequired additions to .env.example
Implementation Guide
Replace
TypeOrmModule.forRootwithTypeOrmModule.forRootAsyncusingConfigService. Read all DB settings from env vars. Setsynchronize: trueonly whenNODE_ENV !== 'production'. Enable SSL whenDB_SSL === 'true'withrejectUnauthorized: false. Update e2e tests to use SQLite in-memory override so CI does not need a PostgreSQL instance.Acceptance Criteria
TypeOrmModule.forRootAsyncwith env-based PostgreSQL configsynchronize: trueonly whenNODE_ENV !== 'production'.env.examplewith commentsnpm run start:devworks with local PostgreSQLComplexity: High - 200 points
Join: https://t.me/ByteChainAcademy | Contact: contact@nexacore.org