feat: Migrate to ultrathin monolith architecture
Consolidate 3 separate applications (reports-app, data-entry-app, telegram-bot) into a unified
architecture with single backend and frontend:
Backend Changes:
- Unified FastAPI backend at backend/ with modular structure
- Modules: reports, data_entry, telegram in backend/modules/
- Centralized config.py and main.py with all routers registered
- Single worker mode (--workers 1) for Telegram bot compatibility
- Shared Oracle connection pool and JWT authentication
- Unified requirements.txt and environment configuration
Frontend Changes:
- Single Vue.js SPA with module-based routing
- Unified frontend at src/ with modules in src/modules/{reports,data-entry}/
- Shared components and stores in src/shared/
- Error boundaries for module isolation
- Dual API proxy in Vite for module communication
Infrastructure:
- New unified startup scripts: start-prod.sh, start-test.sh, start-backend.sh
- Environment templates: .env.dev.example, .env.test.example, .env.prod.example
- Updated deployment scripts for Windows IIS
- Simplified SSH tunnel management
Documentation:
- Comprehensive CLAUDE.md with architecture overview
- Module-specific docs in docs/{data-entry,telegram}/
- Architecture decision records in docs/ARCHITECTURE-DECISIONS.md
- Deployment guides consolidated in deployment/windows/docs/
This migration reduces complexity, improves maintainability, and enables easier
deployment while maintaining all existing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
66
backend/modules/reports/cache/__init__.py
vendored
Normal file
66
backend/modules/reports/cache/__init__.py
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"""
|
||||
Cache module for ROA2WEB
|
||||
|
||||
Provides hybrid two-tier caching (Memory L1 + SQLite L2)
|
||||
with performance tracking and event-based invalidation.
|
||||
|
||||
Usage:
|
||||
# Initialize cache at app startup
|
||||
from app.cache import init_cache
|
||||
from app.cache.config import CacheConfig
|
||||
|
||||
config = CacheConfig.from_env()
|
||||
await init_cache(config)
|
||||
|
||||
# Use @cached decorator in services
|
||||
from app.cache.decorators import cached
|
||||
|
||||
@cached(cache_type='dashboard_summary', key_params=['company', 'username'])
|
||||
async def get_complete_summary(company: str, username: str):
|
||||
# ... Oracle query logic ...
|
||||
|
||||
# Get cache manager for manual operations
|
||||
from app.cache import get_cache
|
||||
|
||||
cache = get_cache()
|
||||
await cache.invalidate(company_id=123)
|
||||
"""
|
||||
|
||||
from .config import CacheConfig
|
||||
from .cache_manager import (
|
||||
init_cache,
|
||||
get_cache,
|
||||
close_cache,
|
||||
CacheManager
|
||||
)
|
||||
from .decorators import cached
|
||||
from .event_monitor import (
|
||||
init_event_monitor,
|
||||
get_event_monitor,
|
||||
toggle_event_monitor,
|
||||
preload_all_schema_mappings
|
||||
)
|
||||
from .benchmarks import run_baseline_benchmarks
|
||||
|
||||
__all__ = [
|
||||
# Configuration
|
||||
'CacheConfig',
|
||||
|
||||
# Cache Manager
|
||||
'init_cache',
|
||||
'get_cache',
|
||||
'close_cache',
|
||||
'CacheManager',
|
||||
|
||||
# Decorators
|
||||
'cached',
|
||||
|
||||
# Event Monitor
|
||||
'init_event_monitor',
|
||||
'get_event_monitor',
|
||||
'toggle_event_monitor',
|
||||
'preload_all_schema_mappings',
|
||||
|
||||
# Benchmarks
|
||||
'run_baseline_benchmarks',
|
||||
]
|
||||
Reference in New Issue
Block a user