How thilakreddyy/jntuh-backend works
Main Architectural Components
• API/HTTP Layer: Represented by FastAPI endpoints (see api/routes.py). This is the interface through which client requests enter the system.
• Service Layer: The business logic implemented in the various service modules (e.g., service/getAllResultService.py, service/notificationService.py, etc.) that process and transform data before interacting with data stores.
• Database Layer: Managed via the database directory and Prisma setup. This includes:
• PostgreSQL as the primary persistent datastore.
• ORM/migrations managed by Prisma (look at prisma/schema.prisma and corresponding migrations).
• Caching Layer: Redis is integrated for performance optimization (look into config/redisConnection.py).
• Messaging Layer: Uses RabbitMQ for event-driven data exchange (messaging/consumer.py and messaging/publisher.py).
• Additional Components:
• Scrapers: These modules (in the scrapers folder) handle data fetching and notifications.
• Utility Components: Helpers and logging (in the utils directory) that support overall system operations.
• Containerization and Deployment: Dockerfile, docker-compose.yml, and related files provide the infrastructure design for deployment.
Relationships and Interactions
• The API Layer receives HTTP requests and passes them to the Service Layer.
• The Service Layer performs necessary business logic and coordinates data retrieval and processing:
• It interacts with the Database Layer (using models and operations defined in database/models.py and database/operations.py).
• Caching interactions are made through Redis (config/redisConnection.py); typically, data is first checked/updated in the cache.
• Messaging operations: When events occur (like updates or notifications), the Service Layer publishes messages to RabbitMQ (using messaging/publisher.py) and possibly consumes messages (with messaging/consumer.py) to trigger further processing.
• The Scraper modules likely run separately (or scheduled via an external trigger) to fetch external data (e.g., result updates) and feed it into the system.
Architectural Patterns and Design Principles
• Layered Architecture: Separation of concerns into API, Service, Database, Caching, and Messaging layers.
• Microservice-like Components: Although it is a monolithic FastAPI app, the clear divisions (services, messaging, scrapers) allow for future decoupling if required.
• Asynchronous / Event-Driven Processing: RabbitMQ integration shows a design that supports asynchronous communications.
• Containerization: Docker file and Docker Compose file promote a containerized and portable deployment.
Technologies and Frameworks to Emphasize
• FastAPI for API handling.
• PostgreSQL (with Prisma for migrations) as the database.
• Redis for caching.
• RabbitMQ for messaging.
• Docker and Docker Compose for container deployment.
• Monitoring tools: Prometheus and Grafana.
• Python utilities and logging tools for support and maintenance.