Installation Guide
This guide walks you through setting up Athena ERP on your local machine for development. Athena ERP is a modern school management system designed specifically for Colombian schools, with multi-tenant architecture and role-based access control.System Requirements
Backend Requirements
- Python 3.12+
- PostgreSQL 16+
- Docker & Docker Compose (recommended)
- pip package manager
Frontend Requirements
- Node.js 18+ or 20+
- npm 9+ or equivalent
- Modern web browser
Architecture Overview
Athena ERP consists of two main components:- Backend API (
athena-api): FastAPI-based REST API with PostgreSQL - Frontend (
athena-front): React 19 + Vite + TailwindCSS
This guide focuses on local development. For production deployment, see the Deployment Overview guide.
Step 1: Clone the Repository
First, clone the Athena ERP repository:Step 2: Backend Setup
Start PostgreSQL with Docker
The easiest way to get PostgreSQL running is with Docker Compose:This starts a PostgreSQL 16 container with the following configuration:
- Host:
localhost:5432 - Database:
athena_db - User:
athena - Password:
athena_dev
Optional: Start pgAdmin
Optional: Start pgAdmin
For a visual database interface, start pgAdmin:Access pgAdmin at http://localhost:5050:
- Email:
[email protected] - Password:
admin
Alternative: Local PostgreSQL
Alternative: Local PostgreSQL
If you prefer to use a locally installed PostgreSQL:Update your
.env file accordingly.Create environment configuration
Copy the example environment file and configure it:Edit
.env with your settings:Install Python dependencies
Install the API and its dependencies using pip:This installs all required packages from
pyproject.toml:- FastAPI 0.115+ (web framework)
- SQLAlchemy 2.0+ (ORM with async support)
- Pydantic 2.10+ (data validation)
- Alembic 1.14+ (database migrations)
- asyncpg 0.30+ (PostgreSQL async driver)
- python-jose (JWT handling)
Development Dependencies
Development Dependencies
For development, also install dev dependencies:This includes:
- pytest + pytest-asyncio (testing)
- ruff (linting)
- httpx (API testing)
Run database migrations
Initialize the database schema using Alembic:This creates all tables defined in the migrations:
users- User accountsschools- School/tenant recordsschool_memberships- User-school relationshipsstudents- Student profilesguardians- Guardian/parent informationenrollments- Student enrollments by yearacademic_periods- Grading periodsgrades- Academic gradesattendance- Attendance recordsdiscipline_records- Behavioral incidentscommunications- Messages and circulars
View Migration Status
View Migration Status
Check which migrations have been applied:View migration history:
Start the API server
Run the FastAPI development server:You should see:Verify the API is running:Expected response:
Access API documentation
Open your browser and navigate to:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Step 3: Frontend Setup
Install Node.js dependencies
Install all frontend packages:This installs the key dependencies:
- React 19 (UI library)
- Vite 6.2 (build tool)
- TailwindCSS 4.1 (styling)
- React Router 7 (routing)
- TanStack Query 5 (data fetching)
- Zustand 5 (state management)
- React Hook Form (forms)
- Axios (HTTP client)
- Supabase JS (authentication)
Configure environment variables
Create your frontend environment configuration:Edit
.env:Supabase configuration is optional for local development. You can use local JWT authentication initially and add Supabase later for production.
Start the development server
Verify the frontend loads
Open http://localhost:3000 in your browser. You should see the Athena ERP login page.
Step 4: Create Your First Admin User
Before you can log in, you need to create an admin user:Script Details
Script Details
The
create_superadmin.py script:- Creates or updates a user in the
userstable - Assigns the
superadminrole - Is idempotent (safe to run multiple times)
- Can optionally link to a specific school with
--school-id
athena-api/scripts/create_superadmin.py.- Email:
admin@localhost - Password: (set via Supabase or local auth)
Verification Checklist
Ensure everything is working:API docs are accessible
Visit http://localhost:8000/docs and verify Swagger UI loads with all endpoints.
Frontend is running
Visit http://localhost:3000 and verify the login page appears.
Docker Development (Alternative)
If you prefer to run everything in Docker:Development Workflow
Backend Development
The backend uses FastAPI with hot-reload enabled:Frontend Development
The frontend uses Vite with HMR (Hot Module Replacement):Common Issues
Port already in use
Port already in use
If port 8000 or 3000 is already in use:Backend:Frontend:Update
CORS_ORIGINS in backend .env and VITE_API_URL in frontend .env accordingly.Database connection failed
Database connection failed
Ensure PostgreSQL is running:If using external PostgreSQL, verify:
- PostgreSQL service is running
- Database
athena_dbexists - User
athenahas proper permissions DATABASE_URLin.envis correct
Migration errors
Migration errors
If migrations fail:For a fresh start:
Module not found errors (Python)
Module not found errors (Python)
Ensure you’re in the correct directory and the package is installed:
CORS errors in browser
CORS errors in browser
CORS errors occur when the frontend origin isn’t whitelisted. Update backend Restart the API server after changing
.env:.env.Frontend build errors
Frontend build errors
Clear node modules and reinstall:Verify Node.js version:
Database Management
Accessing the Database
Via Docker:--profile tools)
Useful SQL Commands
Backup and Restore
Backup:Environment Variables Reference
Backend (athena-api)
| Variable | Description | Default | Required |
|---|---|---|---|
ENVIRONMENT | Deployment environment | development | No |
DATABASE_URL | PostgreSQL connection string | See .env.example | Yes |
JWT_SECRET | Secret key for signing JWTs | - | Yes |
JWT_ALGORITHM | JWT algorithm | HS256 | No |
ACCESS_TOKEN_EXPIRE_MINUTES | Token expiration | 30 | No |
CORS_ORIGINS | Allowed CORS origins (comma-separated) | http://localhost:3000 | Yes |
SUPABASE_URL | Supabase project URL | - | No |
SUPABASE_ANON_KEY | Supabase anonymous key | - | No |
SUPABASE_SERVICE_ROLE_KEY | Supabase service role key | - | No |
R2_ENDPOINT_URL | Cloudflare R2 endpoint | - | No |
R2_ACCESS_KEY_ID | R2 access key | - | No |
R2_SECRET_ACCESS_KEY | R2 secret key | - | No |
R2_BUCKET_NAME | R2 bucket name | athena-docs | No |
SENTRY_DSN | Sentry error tracking DSN | - | No |
Frontend (athena-front)
| Variable | Description | Required |
|---|---|---|
VITE_API_URL | Backend API URL | Yes |
VITE_SUPABASE_URL | Supabase project URL | No |
VITE_SUPABASE_ANON_KEY | Supabase anonymous key | No |
Next Steps
Now that you have Athena ERP installed:Quickstart Guide
Create your first school and enroll students
API Reference
Explore all available endpoints
Configuration
Configure roles, permissions, and settings
Production Deployment
Deploy to Railway, GCP, or your own infrastructure
Development Resources
- FastAPI Documentation: https://fastapi.tiangolo.com
- SQLAlchemy 2.0: https://docs.sqlalchemy.org/en/20/
- React 19: https://react.dev
- Vite: https://vitejs.dev
- TailwindCSS: https://tailwindcss.com
- Supabase: https://supabase.com/docs