How azarenkov/aitu-keeper works
Main Components
• Backend (API) Layer: Highlight the controllers (located in src/controllers). Note that there are specific controllers for courses, deadlines, grades, and users, which expose endpoints.
• Service Layer: Include the services (in src/services) that encapsulate business logic. Services like data_service and producer_service represent the core processing logic.
• Repository Layer: Represent the repositories (src/repositories) handling data interactions with the underlying storage (MongoDB).
• Infrastructure Layer: This consists of:
• App setup and initialization (app_setup.rs)
• External service integrations:
• Moodle Client (src/infrastructure/client/moodle_client.rs) for fetching Moodle data.
• Database connection module for MongoDB (src/infrastructure/db).
• Event producer modules (src/infrastructure/event_producer) that interact with Apache Kafka.
• Configuration: src/config.rs for configuration settings.
• External Systems: Clearly represent external tools and services:
• Moodle – the source of the raw educational data.
• MongoDB – persistent storage.
• Apache Kafka – message/event bus.
• Firebase Cloud Messaging – for notifications.
Relationships and Data Flow
• Incoming Requests: Clients (could be dashboards or mobile devices) send requests to the controllers.
• Data Handling: Controllers call the service layer to process business logic.
• Persistence: Services interact with repositories to read/write data to MongoDB.
• Integration: When data changes (e.g., grade updates), the service triggers:
a. An event producer in the infrastructure layer to send a message to Kafka.
b. Downstream, Kafka events are used to notify client devices via Firebase Cloud Messaging.
• External Data Fetch: A separate integration point via the Moodle client fetches the initial or updated data from Moodle.
Architectural Patterns
• Layered Architecture: The clear separation between controllers, services, repositories, and infrastructure.
• Integration with External Systems: Use of a modular design to isolate service integration (Moodle API, database, Kafka) helps maintain a decoupled and testable codebase.
Final Assembly
• Follow the flow into the repository (data persistence) and infrastructure modules (Moodle client, event producer).