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:
110
README.md
110
README.md
@@ -1,20 +1,20 @@
|
||||
# ROA2WEB - Modern ERP Reports Application
|
||||
# ROA2WEB - Modern ERP Application
|
||||
|
||||
**FastAPI Backend + Vue.js 3 Frontend + Telegram Bot**
|
||||
|
||||
Modern microservices-based ERP reporting application for managing invoices, payments, and financial data with Oracle database integration.
|
||||
Modern ultrathin monolith ERP application for managing reports, data entry, and financial data with Oracle database integration.
|
||||
|
||||
---
|
||||
|
||||
## Project Overview
|
||||
|
||||
ROA2WEB is a comprehensive financial reporting platform built with modern technologies:
|
||||
ROA2WEB is a comprehensive financial platform built with modern technologies:
|
||||
|
||||
- **Backend**: FastAPI (Python) - High-performance async API
|
||||
- **Frontend**: Vue.js 3 + PrimeVue - Rich, responsive web interface
|
||||
- **Telegram Bot**: Alternative command-based interface
|
||||
- **Database**: Oracle Database with connection pooling
|
||||
- **Architecture**: Microservices with shared components
|
||||
- **Backend**: FastAPI (Python) - Unified async API with modular architecture
|
||||
- **Frontend**: Vue.js 3 + PrimeVue - Single-page application with lazy-loaded modules
|
||||
- **Telegram Bot**: Alternative command-based interface (integrated module)
|
||||
- **Database**: Oracle Database + SQLite (hybrid approach)
|
||||
- **Architecture**: Ultrathin monolith with clear module boundaries
|
||||
|
||||
---
|
||||
|
||||
@@ -35,16 +35,16 @@ git clone <repository-url>
|
||||
cd roa2web
|
||||
|
||||
# Start all services with one command
|
||||
./start-dev.sh
|
||||
./start-prod.sh
|
||||
```
|
||||
|
||||
This starts SSH tunnel, backend (port 8001), and frontend (port 3000-3005).
|
||||
This starts SSH tunnel, unified backend (port 8001), and frontend (port 3000).
|
||||
|
||||
**For individual service setup or troubleshooting**: See "Development & Testing" section below or component-specific READMEs.
|
||||
**For individual service setup or troubleshooting**: See "Development & Testing" section below.
|
||||
|
||||
### Access the Application
|
||||
|
||||
- **Frontend**: http://localhost:3000 (or 3001-3005 if 3000 is busy)
|
||||
- **Frontend**: http://localhost:3000
|
||||
- **Backend API Docs**: http://localhost:8001/docs (Swagger UI)
|
||||
- **Backend ReDoc**: http://localhost:8001/redoc
|
||||
- **Health Check**: http://localhost:8001/health
|
||||
@@ -53,29 +53,39 @@ This starts SSH tunnel, backend (port 8001), and frontend (port 3000-3005).
|
||||
|
||||
## Architecture
|
||||
|
||||
### Directory Structure
|
||||
### Ultrathin Monolith Structure
|
||||
|
||||
```
|
||||
|
||||
├── shared/ # Shared components
|
||||
│ ├── database/ # Oracle connection pool (singleton)
|
||||
│ ├── auth/ # JWT authentication & middleware
|
||||
│ └── utils/ # Common utilities
|
||||
.
|
||||
├── backend/ # Unified FastAPI backend (port 8001)
|
||||
│ ├── modules/ # Business logic modules
|
||||
│ │ ├── reports/ # Reports module (Oracle read-only)
|
||||
│ │ ├── data_entry/ # Data entry module (SQLite + workflow)
|
||||
│ │ └── telegram/ # Telegram bot module
|
||||
│ ├── config.py # Centralized configuration
|
||||
│ └── main.py # FastAPI app entry point
|
||||
│
|
||||
├── reports-app/ # Main reports application
|
||||
│ ├── backend/ # FastAPI backend (port 8001)
|
||||
│ ├── frontend/ # Vue.js 3 frontend (port 3000-3005)
|
||||
│ └── telegram-bot/ # Telegram bot (port 8002)
|
||||
├── src/ # Unified Vue.js 3 frontend
|
||||
│ ├── modules/ # Feature modules
|
||||
│ │ ├── reports/ # Reports frontend
|
||||
│ │ └── data-entry/ # Data entry frontend
|
||||
│ ├── shared/ # Shared frontend components
|
||||
│ ├── assets/ # Global CSS, images
|
||||
│ └── router/ # Vue Router
|
||||
│
|
||||
├── nginx/ # Nginx reverse proxy config
|
||||
├── ssh-tunnel/ # SSH tunnel for Oracle DB
|
||||
├── deployment/ # Deployment scripts (Linux & Windows)
|
||||
└── scripts/ # Utility scripts
|
||||
├── shared/ # Shared backend components
|
||||
│ ├── database/ # Oracle connection pool
|
||||
│ ├── auth/ # JWT authentication
|
||||
│ └── frontend/ # Shared frontend assets
|
||||
│
|
||||
├── docs/ # Documentation
|
||||
├── deployment/ # Deployment scripts
|
||||
└── ssh-tunnel/ # SSH tunnel for Oracle DB
|
||||
```
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Shared Database Pool**: Singleton Oracle connection pool shared across microservices
|
||||
- **Shared Database Pool**: Singleton Oracle connection pool shared across all modules
|
||||
- **Two-Tier Cache System**: Hybrid L1 (Memory) + L2 (SQLite) for optimal performance
|
||||
- **JWT Authentication**: Secure token-based auth with middleware
|
||||
- **Microservices**: Independent services with clear separation of concerns
|
||||
@@ -98,21 +108,21 @@ This starts SSH tunnel, backend (port 8001), and frontend (port 3000-3005).
|
||||
|
||||
## Development & Testing
|
||||
|
||||
**Quick Start**: Use `./start-dev.sh` to start all services (SSH tunnel + Backend + Frontend).
|
||||
**Quick Start**: Use `./start-prod.sh` to start all services (SSH tunnel + Backend + Frontend).
|
||||
|
||||
**For detailed development commands, testing procedures, and troubleshooting**: See `CLAUDE.md` and component-specific READMEs:
|
||||
- Backend: `reports-app/backend/README.md`
|
||||
- Frontend: `reports-app/frontend/README.md` & `reports-app/frontend/tests/README.md`
|
||||
- Backend: `backend/ modules and CLAUDE.md`
|
||||
- Frontend: `src/ and docs/MONOLITH_ARCHITECTURE.md` & `E2E testing guide in docs/`
|
||||
- Telegram Bot: `reports-app/telegram-bot/README.md`
|
||||
|
||||
**Key Commands**:
|
||||
```bash
|
||||
# Start All Services (FAST with parallel backend startup - ~11s dev, ~33s test)
|
||||
./start-dev.sh # Start all (SSH tunnel + Backends + Bot + Frontend)
|
||||
./start-prod.sh # Start all (SSH tunnel + Backends + Bot + Frontend)
|
||||
./start-test.sh # Start all (TEST environment)
|
||||
|
||||
# Individual Service Control (NEW - for quick restarts!)
|
||||
./frontend.sh start|stop|restart|status # Frontend only (~7s restart!)
|
||||
./start-frontend.sh start|stop|restart|status # Frontend only (~7s restart!)
|
||||
./backend-reports.sh start|stop|status # Reports backend only
|
||||
./backend-data-entry.sh start|stop|status # Data Entry backend only
|
||||
./bot.sh start|stop|status # Telegram bot only
|
||||
@@ -121,53 +131,53 @@ This starts SSH tunnel, backend (port 8001), and frontend (port 3000-3005).
|
||||
./status.sh # Show all services status + health checks
|
||||
|
||||
# Infrastructure Only
|
||||
./ssh_tunnel.sh start|stop|status # Oracle DB tunnel (production)
|
||||
./ssh-tunnel-prod.sh start|stop|status # Oracle DB tunnel (production)
|
||||
./ssh-tunnel-test.sh start|stop|status # Oracle TEST tunnel
|
||||
```
|
||||
|
||||
**💡 Pro Tips**:
|
||||
- **Frontend changes?** Use `./frontend.sh restart` instead of restarting everything (87% faster!)
|
||||
- **Frontend changes?** Use `./start-frontend.sh restart` instead of restarting everything (87% faster!)
|
||||
- **Check what's running:** `./status.sh` shows everything at a glance
|
||||
- **Backend-uri pornesc în paralel** în start-dev.sh și start-test.sh pentru pornire mai rapidă
|
||||
- **Backend-uri pornesc în paralel** în start-prod.sh și start-test.sh pentru pornire mai rapidă
|
||||
|
||||
### 📖 Usage Flow
|
||||
|
||||
**Individual scripts (`frontend.sh`, `backend-*.sh`, `bot.sh`) are environment-neutral:**
|
||||
**Individual scripts (`start-frontend.sh`, `start-backend.sh`, `backend-*.sh`, `bot.sh`) are environment-neutral:**
|
||||
- They DON'T change `.env` files
|
||||
- They use whatever `.env` is already present
|
||||
- Use them for **quick restarts** when working on a specific service
|
||||
|
||||
**Master scripts (`start-dev.sh`, `start-test.sh`) set the environment:**
|
||||
- `start-dev.sh` → uses existing `.env` files (DEV mode)
|
||||
**Master scripts (`start-prod.sh`, `start-test.sh`) set the environment:**
|
||||
- `start-prod.sh` → uses existing `.env` files (DEV mode)
|
||||
- `start-test.sh` → copies `.env.test` → `.env` (TEST mode)
|
||||
|
||||
**Recommended workflow:**
|
||||
|
||||
```bash
|
||||
# Morning: Start full stack with environment selection
|
||||
./start-dev.sh # DEV mode - sets up .env files
|
||||
./start-prod.sh # DEV mode - sets up .env files
|
||||
|
||||
# During development: Quick service restarts
|
||||
./frontend.sh restart # Frontend only (~7s)
|
||||
./start-frontend.sh restart # Frontend only (~7s)
|
||||
./backend-reports.sh restart # Reports backend only (~30s)
|
||||
# ⚠️ Individual scripts inherit the environment set by start-dev.sh
|
||||
# ⚠️ Individual scripts inherit the environment set by start-prod.sh
|
||||
|
||||
# End of day: Stop everything
|
||||
./start-dev.sh stop
|
||||
./start-prod.sh stop
|
||||
```
|
||||
|
||||
**Common scenarios:**
|
||||
|
||||
```bash
|
||||
# Scenario 1: Working on frontend only
|
||||
./start-dev.sh # Start everything once
|
||||
./frontend.sh restart # Restart frontend multiple times (fast!)
|
||||
./start-prod.sh # Start everything once
|
||||
./start-frontend.sh restart # Restart frontend multiple times (fast!)
|
||||
|
||||
# Scenario 2: Debugging a single backend
|
||||
./start-dev.sh stop # Stop all
|
||||
./ssh_tunnel.sh start # Infrastructure only
|
||||
./start-prod.sh stop # Stop all
|
||||
./ssh-tunnel-prod.sh start # Infrastructure only
|
||||
./backend-reports.sh start # Just the backend you need
|
||||
./frontend.sh start # Just the frontend
|
||||
./start-frontend.sh start # Just the frontend
|
||||
|
||||
# Scenario 3: Testing mode
|
||||
./start-test.sh # Starts everything in TEST mode
|
||||
@@ -295,9 +305,9 @@ BACKEND_API_URL=http://localhost:8001
|
||||
|
||||
### Component-Specific
|
||||
- `README.md` - Main application README
|
||||
- `reports-app/backend/README.md` - Backend specifics
|
||||
- `reports-app/frontend/README.md` - Frontend guide
|
||||
- `reports-app/frontend/tests/README.md` - Frontend testing
|
||||
- `backend/ modules and CLAUDE.md` - Backend specifics
|
||||
- `src/ and docs/MONOLITH_ARCHITECTURE.md` - Frontend guide
|
||||
- `E2E testing guide in docs/` - Frontend testing
|
||||
- `reports-app/telegram-bot/README.md` - Telegram bot guide
|
||||
- `reports-app/telegram-bot/TELEGRAM_COMMANDS.md` - Bot commands
|
||||
|
||||
|
||||
Reference in New Issue
Block a user