c1accd82c585eed8fc911277a5e4b879a7aa1512
NextGen PPR System
A modern, containerized Prior Permission Required (PPR) system for aircraft operations management.
Architecture
- Backend: FastAPI with Python 3.11
- Database: MySQL 8.0
- Cache: Redis 7
- Container: Docker & Docker Compose
Features
- 🚀 Modern API: RESTful API with automatic OpenAPI documentation
- 🔐 Authentication: JWT-based authentication system
- 📊 Real-time Updates: WebSocket support for live tower updates
- 🗄️ Self-contained: Fully dockerized with local database
- 🔍 Documentation: Auto-generated API docs at
/docs - 🧪 Testing: Comprehensive test suite
- 📱 Mobile Ready: Responsive design for tower operations
Quick Start
Prerequisites
- Docker and Docker Compose installed
1. Start the System
cd nextgen
./start.sh
2. Access the Services
- API Documentation: http://localhost:8001/docs
- API Base URL: http://localhost:8001/api/v1
- Database: localhost:3307 (user: ppr_user, password: ppr_password123)
3. Default Login
- Username: admin
- Password: admin123
API Endpoints
Authentication
POST /api/v1/auth/login- Login and get JWT token
PPR Management
GET /api/v1/pprs- List PPR recordsPOST /api/v1/pprs- Create new PPRGET /api/v1/pprs/{id}- Get specific PPRPUT /api/v1/pprs/{id}- Update PPRPATCH /api/v1/pprs/{id}/status- Update PPR statusDELETE /api/v1/pprs/{id}- Delete PPR
Public Endpoints (No Auth Required)
GET /api/v1/public/arrivals- Today's arrivalsGET /api/v1/public/departures- Today's departures
Real-time
WebSocket /ws/tower-updates- Live updates for tower operations
Development
Local Development
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload
Database Management
# Connect to database
docker exec -it ppr_nextgen_db mysql -u ppr_user -p ppr_nextgen
# View logs
docker-compose logs -f api
docker-compose logs -f db
# Restart services
docker-compose restart
Testing
cd backend
pytest tests/
Environment Variables
Key environment variables (configured in docker-compose.yml):
DB_HOST- Database hostDB_USER- Database usernameDB_PASSWORD- Database passwordDB_NAME- Database nameSECRET_KEY- JWT secret keyACCESS_TOKEN_EXPIRE_MINUTES- Token expiration time
Database Schema
The system uses an improved version of the original schema with:
- users - User authentication
- submitted - PPR records with status tracking
- journal - Activity logs with foreign keys
- airports - Airport reference data
- aircraft - Aircraft registration database
Data Migration
To migrate data from the old system:
- Export data from the old database
- Transform to new schema format
- Import into the new system
Security
- JWT token authentication
- Password hashing with bcrypt
- Input validation with Pydantic
- SQL injection protection via SQLAlchemy ORM
- CORS configuration for frontend integration
Performance
- Database connection pooling
- Indexed columns for fast queries
- Redis caching (ready for implementation)
- Async/await for non-blocking operations
Monitoring
Access logs and monitoring:
# View API logs
docker-compose logs -f api
# View database logs
docker-compose logs -f db
# System health check
curl http://localhost:8001/health
Stopping the System
docker-compose down
To remove volumes (database data):
docker-compose down -v
Description
Languages
HTML
64.2%
Python
29.3%
JavaScript
3%
CSS
2.2%
Shell
1.1%
Other
0.1%