mnemo_cards/mnemo_cards_backend/project_config.md
2026-01-03 16:14:27 +03:00

1.4 KiB

Project Config: Isar to PostgreSQL Migration

Goal

Migrate mnemo_cards_backend from embedded Isar database to production-ready PostgreSQL with Drift ORM.

Stack

  • Database: PostgreSQL 16
  • ORM: Drift 2.14.0
  • Language: Dart 3.0+
  • Backend: Shelf framework

Constraints

  • Must maintain backward compatibility during migration
  • Zero-downtime deployment preferred
  • All existing functionality must work after migration
  • Follow clean architecture principles
  • Write unit tests for all new code

Commands

# Setup PostgreSQL (Docker)
cd mnemo_cards_backend
docker-compose up -d postgres

# Install dependencies
dart pub get

# Generate Drift code
dart run build_runner build --delete-conflicting-outputs

# Run tests
dart test

# Format code
dart format .

# Analyze code
dart analyze

Acceptance Criteria

  • PostgreSQL running and accessible
  • All Drift schemas created and generated
  • All DAOs implemented with CRUD operations
  • All existing code refactored to use Drift
  • All unit tests pass
  • Integration tests pass
  • Docker image builds successfully
  • Backend starts and connects to PostgreSQL
  • API endpoints work correctly

Environment Variables

  • DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
  • DB_SSL_MODE (disable for dev, require for prod)
  • PORT, SERVER_ADDRESS, WORK_DIR, DEBUG
  • ADMIN_IDS, JWT_SECRET, JWT_REFRESH_SECRET