Overview
Athena ERP is built with a modern, scalable architecture designed for multi-tenant SaaS deployment. The stack prioritizes developer productivity, type safety, and compliance with Colombian regulations.Frontend Stack
Core Framework
| Technology | Version | Purpose |
|---|---|---|
| React | 19.0.0 | UI framework with concurrent features |
| TypeScript | 5.8.2 | Type safety and developer experience |
| Vite | 6.2.0 | Build tool and dev server |
| React Router | 7.13.1 | Client-side routing |
State Management & Data Fetching
Zustand
Global state management with persist middleware for auth state
TanStack Query
Server state management, caching, and synchronization
UI & Styling
- Tailwind CSS 4.1.14 - Utility-first CSS framework
- Motion 12.23.24 - Animation library for smooth transitions
- Lucide React 0.546.0 - Icon library
- Recharts 3.8.0 - Charts and data visualization
- Sonner 2.0.7 - Toast notifications
Form Handling
- React Hook Form 7.71.2
- Zod 4.3.6
- @hookform/resolvers 5.2.2
Authentication
- Supabase Auth 2.98.0 - Managed authentication service
- JWT tokens with refresh token rotation
- Role-based access control (RBAC) enforced in both frontend and backend
HTTP Client
- Axios 1.13.6 - HTTP client with interceptors for auth tokens
- Base URL configuration via environment variables
Backend Stack
Core Framework
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.12+ | Language runtime |
| FastAPI | 0.115+ | Modern async web framework |
| Uvicorn | 0.34+ | ASGI server with standard extras |
| Pydantic | 2.10+ | Data validation and settings |
FastAPI automatically generates OpenAPI documentation at
/docs (Swagger UI) and /redoc in development mode.Database Layer
SQLAlchemy 2.0
Async ORM for PostgreSQL with relationship loading and query optimization
Alembic
Database migration management with version control
sqlalchemy[asyncio]2.0+ - Core ORM with async supportasyncpg0.30+ - Async PostgreSQL driveralembic1.14+ - Migration tool
Authentication & Security
python-jose[cryptography]3.3+ - JWT encoding/decodinghttpx0.28+ - Async HTTP client for Supabase API
File Storage
- Cloudflare R2 via boto3 - S3-compatible object storage
boto31.35+ - AWS SDK for Pythonpython-multipart0.0.20+ - File upload handling
Performance & Monitoring
| Package | Purpose |
|---|---|
| slowapi 0.1.9+ | Rate limiting without Redis |
| sentry-sdk[fastapi] 2.5+ | Error tracking and monitoring |
Development Tools
Database
PostgreSQL
Supabase PostgreSQL
Managed PostgreSQL with free tier sufficient for 20-40 schools in MVP
- JSONB columns for flexible metadata
- Composite indexes for tenant isolation
- Foreign key constraints with CASCADE/RESTRICT
- Check constraints for data integrity
- Async connection pooling (10 connections, 20 max overflow)
Why Not RLS?
Athena intentionally does not use Row Level Security (RLS):✅ Chosen Approach
- Backend middleware enforces tenant isolation
- Testable with pytest
- Portable to any PostgreSQL
- Easier to debug
❌ Not Using RLS
- Vendor lock-in to PostgreSQL RLS
- Logic split between DB and backend
- Harder to test isolation
- Difficult to debug leaks
Hosting & Infrastructure
Development
- Frontend: Vite dev server (port 3000)
- Backend: Uvicorn with hot reload
- Database: Local PostgreSQL or Supabase
MVP Deployment
Production Roadmap
Type Safety
Frontend ↔ Backend Contract
- No manual interface duplication
- Type errors caught at build time
- API changes break the build immediately
Validation Layers
Environment Configuration
Frontend (.env)
Backend (.env)
Architecture Diagram
Next Steps
Database Schema
Explore the complete database design and relationships
Multi-Tenancy
Learn how tenant isolation is implemented