Transformare arhitecturală de la 3 backend-uri separate la monolith ULTRATHIN:
- 1 singur proces FastAPI (port 8000) în loc de 3 (8001, 8003, 8002)
- Telegram bot integrat în același proces (nu separat)
- Structură modulară păstrată: backend/modules/{reports,data-entry,telegram}/
- Log-uri unificate cu prefixe de modul
- Deploy Windows simplificat: 1 serviciu NSSM în loc de 3
- Startup paralel: Oracle pool + PaddleOCR
- Curățenie cod: eliminare duplicări, cod mort
- URL-uri API păstrate: /api/reports/*, /api/data-entry/*, /api/telegram/*
Estimare: 21-31 ore (3-4 zile)
Fișiere afectate: ~70 (10 critice)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
122 lines
4.7 KiB
JSON
122 lines
4.7 KiB
JSON
{
|
|
"feature": "ultrathin-monolith",
|
|
"status": "spec_created",
|
|
"created_at": "2025-12-24T00:00:00Z",
|
|
"updated_at": "2025-12-24T00:00:00Z",
|
|
"spec_version": "1.0",
|
|
"complexity": "high",
|
|
"estimated_hours": "21-31",
|
|
"estimated_days": "3-4",
|
|
"key_changes": [
|
|
"Single backend entry point (backend/main.py) replacing 3 separate main.py files",
|
|
"Module-based directory structure (backend/modules/reports, backend/modules/data-entry, backend/modules/telegram)",
|
|
"API URL changes with module prefixes (/api/reports/*, /api/data-entry/*, /api/telegram/*)",
|
|
"Telegram bot integrated into main process (background task)",
|
|
"Parallel initialization (Oracle pool + PaddleOCR)",
|
|
"Unified logging with module prefixes",
|
|
"Single virtual environment with merged dependencies",
|
|
"Single Windows service for deployment (instead of 3)"
|
|
],
|
|
"modules_affected": [
|
|
"reports-app/backend",
|
|
"data-entry-app/backend",
|
|
"reports-app/telegram-bot",
|
|
"frontend (vite.config.js, web.config)",
|
|
"shared/database",
|
|
"shared/auth",
|
|
"deployment/windows"
|
|
],
|
|
"files_to_create": [
|
|
"/backend/main.py",
|
|
"/backend/config.py",
|
|
"/backend/requirements.txt",
|
|
"/backend/.env.example",
|
|
"/backend/modules/__init__.py",
|
|
"/backend/modules/reports/__init__.py",
|
|
"/backend/modules/data-entry/__init__.py",
|
|
"/backend/modules/telegram/__init__.py"
|
|
],
|
|
"files_to_move": [
|
|
"reports-app/backend/app/routers/* -> backend/modules/reports/routers/",
|
|
"reports-app/backend/app/services/* -> backend/modules/reports/services/",
|
|
"reports-app/backend/app/models/* -> backend/modules/reports/models/",
|
|
"reports-app/backend/app/cache/* -> backend/modules/reports/cache/",
|
|
"data-entry-app/backend/app/routers/* -> backend/modules/data-entry/routers/",
|
|
"data-entry-app/backend/app/services/* -> backend/modules/data-entry/services/",
|
|
"data-entry-app/backend/app/db/* -> backend/modules/data-entry/db/",
|
|
"data-entry-app/backend/migrations/* -> backend/modules/data-entry/migrations/",
|
|
"reports-app/telegram-bot/app/bot/* -> backend/modules/telegram/bot/",
|
|
"reports-app/telegram-bot/app/db/* -> backend/modules/telegram/db/"
|
|
],
|
|
"critical_files": [
|
|
"/backend/main.py (NEW - single entry point)",
|
|
"/backend/config.py (NEW - unified configuration)",
|
|
"/frontend/vite.config.js (UPDATE - single proxy)",
|
|
"/frontend/public/web.config (UPDATE - single IIS rule)",
|
|
"reports-app/backend/app/main.py (MIGRATE to unified)",
|
|
"data-entry-app/backend/app/main.py (MIGRATE to unified)",
|
|
"reports-app/telegram-bot/app/main.py (MIGRATE to unified)",
|
|
"shared/database/oracle_pool.py (VERIFY singleton)",
|
|
"/deployment/windows/install-service.ps1 (UPDATE single service)",
|
|
"/start-dev.sh (SIMPLIFY single process)"
|
|
],
|
|
"risks": [
|
|
{
|
|
"risk": "Import path issues after moving files",
|
|
"likelihood": "high",
|
|
"impact": "medium",
|
|
"mitigation": "Use absolute imports, update systematically"
|
|
},
|
|
{
|
|
"risk": "Telegram bot blocks main thread",
|
|
"likelihood": "medium",
|
|
"impact": "high",
|
|
"mitigation": "Run in background task with asyncio.create_task()"
|
|
},
|
|
{
|
|
"risk": "Windows service migration breaks deployment",
|
|
"likelihood": "medium",
|
|
"impact": "high",
|
|
"mitigation": "Create new service, test thoroughly, document rollback"
|
|
},
|
|
{
|
|
"risk": "Frontend cache issues with URL changes",
|
|
"likelihood": "medium",
|
|
"impact": "low",
|
|
"mitigation": "Clear browser cache, cache-busting headers"
|
|
}
|
|
],
|
|
"acceptance_criteria_count": 14,
|
|
"out_of_scope_count": 10,
|
|
"dependencies": [
|
|
"Frontend unified app (already completed)",
|
|
"SSH tunnel (unchanged)",
|
|
"Oracle database (unchanged)",
|
|
"Shared modules (auth, database, routes) - unchanged"
|
|
],
|
|
"testing_strategy": [
|
|
"Module-by-module verification during migration",
|
|
"Integration testing after all modules migrated",
|
|
"Frontend connectivity testing",
|
|
"Telegram bot functionality testing",
|
|
"Performance testing (startup time, memory usage)",
|
|
"Windows deployment testing"
|
|
],
|
|
"migration_approach": "big_bang",
|
|
"migration_notes": "Create new structure alongside old, copy files, update imports, test thoroughly, then archive old directories after verification",
|
|
"next_steps": [
|
|
"Review and approve specification",
|
|
"Create backend/ directory structure",
|
|
"Copy files to new structure (keep old as backup)",
|
|
"Update imports module by module",
|
|
"Create unified main.py",
|
|
"Test module routers independently",
|
|
"Integrate Telegram bot",
|
|
"Update frontend configuration",
|
|
"Full integration testing",
|
|
"Update deployment scripts",
|
|
"Update documentation",
|
|
"Archive old backend directories"
|
|
]
|
|
}
|