Nava2 is a modern, asynchronous reporting platform built with FastAPI, Celery, and PostgreSQL.
It enables dynamic report generation based on external data sources (such as MSSQL) and customizable Python-driven templates, producing downloadable PDF reports through a headless Puppeteer service.
- Async report generation with Celery and Redis
- Templated reports defined in a remote GitHub repository
- Dynamic Python logic and validation for each report
- Multi-database support (MSSQL, PostgreSQL, MySQL, MariaDB - extensible)
- Automated PDF rendering using a Node.js Puppeteer microservice
- Admin endpoints for monitoring, syncing, and auditing reports
- Secure authentication via JWT with role-based access (User, Admin)
# Core
SECRET_KEY=change-me
BASE_URL=http://localhost:8000
ACCESS_TOKEN_EXPIRE_MINUTES=60
# Storage
MEDIA_DIR=/data/media
MEDIA_URL=/files
# Databases
DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/nava2
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/1
# MSSQL connection (for report data)
MSSQL_DSN=Driver={ODBC Driver 18 for SQL Server};Server=your-server,1433;Database=yourdb;UID=user;PWD=pass;Encrypt=yes;TrustServerCertificate=yes;Also copy db.env.example → db.env for PostgreSQL container credentials.
Nava2 ships with a ready-to-run Docker Compose setup for local development.
# Build and start all services
docker compose up --build| Service | Description | Port |
|---|---|---|
| web | FastAPI application (REST API + docs) | 8000 |
| worker | Celery worker processing report tasks | — |
| beat | Celery beat scheduler (periodic jobs) | — |
| generator | Puppeteer PDF renderer | 3000 (internal) |
| postgres | PostgreSQL database | 5432 |
| redis | Redis (broker & cache) | 6379 |
Each report template lives in a GitHub repo and defines:
map.json- registry of available templates, arguments, and metadatalogic.py- main script generating placeholders for renderingtest.py- optional pre-check or data validation logictemplate.html- Jinja2-compatible HTML file for rendering
Templates are fetched and cached in Redis. The system periodically syncs the index via Celery beat.
| Stage | Description |
|---|---|
| Pending (P) | Report request created |
| Fetched (F) | Template and arguments validated |
| Generated (G) | PDF successfully rendered |
| Failed (F) | Exception occurred during processing |
| Deleted (D) | Cleaned up or expired |
JWT-based authentication.
POST /api/auth/login→ get token- Use the token in
Authorization: Bearer <token>header for all protected endpoints - Admin endpoints require
is_admin=Trueflag on the user
Public endpoints (e.g., GET /api/reports/{hash_id}) allow unauthenticated access to finalized reports.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/reports |
Submit new report request | ✅ Required |
| GET | /api/reports/{hash_id} |
Publicly retrieve report and PDF link | ❌ Optional |
| POST | /api/admin/templates/sync |
Force sync templates index and assets | ✅ Admin |
| GET | /api/admin/reports |
List and audit reports | ✅ Admin |
Explore the full OpenAPI documentation at:
http://localhost:8000/docs
Generated PDFs are stored inside a shared Docker volume (media) and served directly by the FastAPI application.
- Directory inside containers:
/files - URL prefix:
/files - Example URL:
http://localhost:8000/files/report_hello_simple_1234abcd.pdf
docker compose exec web alembic upgrade headdocker compose exec web python -m app.cli create-user -e user@example.com -p secretdocker compose logs -f web
docker compose logs -f workerruff check . --fixWe welcome contributions!
Please ensure PRs follow the existing code style and include tests when applicable.
- Fork this repository
- Create a new branch (
feature/my-feature) - Submit a pull request once tested