v2.0.0: Production Architecture — PostgreSQL, Celery & Strict Typing
This release graduates TermSub from a single-file prototype to a production-ready, horizontally-scalable architecture.
🏗️ Architecture Overhaul
PostgreSQL replaces SQLite
- Full concurrent access support for multi-worker deployments
- Proper connection pooling and transaction safety
- Production-grade backup and replication ready
Celery + Redis Distributed Task Queue
- Background jobs are now handled by Celery workers instead of a single-threaded local queue
- Redis Pub/Sub for real-time WebSocket broadcasts from distributed workers
- Heartbeat monitoring, timeout recovery, and retry logic at the Celery level
Modern SQLAlchemy 2.0
- Migrated to
Mapped[]/mapped_column()type-safe ORM declarations - Proper session lifecycle management with
get_db_session()context managers
🔧 Code Quality
Strict Static Typing
- Full MyPy
strict = truecompliance across the codebase - Replaced legacy
Optional[X]andList[X]with modernX | Noneandlist[X]syntax - Explicit return type annotations on all functions
Linting & Formatting Pipeline
- Added Ruff for fast linting, import sorting, and code formatting
- Added MyPy for static type checking
- GitHub Actions CI runs both on every push to
main
🗄️ Database & Migrations
- New migration:
add_celery_task_id_column.pyfor Celery task tracking - Enhanced schema validation on startup with clear error messages for outdated databases
📊 Stats
37 files changed, +3,142 / −2,584 lines