How thehimel/learning-platform-api works
Learning Platform API is a FastAPI service for JWT-authenticated users, role-aware course management, enrollments, and ratings. Clients enter through the application and API routers, then follow distinct identity or learning workflows into services, repositories, and PostgreSQL. Rating aggregation may run as a background task. The graph also preserves health/root endpoints and cross-cutting error, security, logging, and rate-limit layers. Some integrations are represented from the tree and README where their implementation was not sampled.
Main entry points: main.py FastAPI App · api/router.py API Router · courses/router.py Course Router · repository.py Course Repository
Components 22
API Entry
- FastAPI App
app/main.py - API Router
app/api/router.py
Identity
- Auth Router
app/auth/router.py - JWT Backend
app/auth/backend.py - User Router
app/users/router.py - User Manager
app/users/manager.py
Learning Domain
- Course Router
app/courses/router.py - Course Service
app/courses/service.py - Course Repository
app/courses/repository.py - Rating Worker
app/courses/router.py - Course Models
app/courses/models.py
Platform Services
- Health Router
app/health/router.py - Health Service
app/health/service.py - Root Router
app/index/router.py - Root Service
app/index/service.py - Error Handler
app/infra/common/exception_handler.py - Security Middleware
app/infra/common/setup_security.py - Request Logging
app/infra/common/setup_request_logging.py - Rate Limiter
app/infra/limiter/limiter.py - Async DB Session
app/infra/database/database.py
Other components
- API Client
- PostgreSQL
Connections 23
- API Client → FastAPI App: sends requests
- FastAPI App → API Router: includes routes
- API Router → Auth Router: includes routes
- API Router → User Router: includes routes
- API Router → Course Router: includes routes
- FastAPI App → Health Router: includes routes
- FastAPI App → Root Router: includes routes
- Auth Router → JWT Backend: dispatches auth
- User Router → User Manager: manages users
- User Manager → PostgreSQL: reads/writes users
- Course Router → Course Service: dispatches courses
- Course Service → Course Repository: executes domain logic
- Course Repository → Course Models: queries models
- Course Repository → PostgreSQL: reads/writes data
- Course Router → Rating Worker: schedules rating
- Rating Worker → Course Service: recomputes rating
- Health Router → Health Service: checks health
- Root Router → Root Service: gets greeting
- FastAPI App → Error Handler: registers handlers
- FastAPI App → Security Middleware: adds security
- FastAPI App → Request Logging: adds logging
- FastAPI App → Rate Limiter: configures limits
- Async DB Session → PostgreSQL: opens sessions