https://github.com/nashtech-garage/online-exams
Build a comprehensive, event-driven online exams platform using Scala and Akka
https://github.com/nashtech-garage/online-exams
akka java17 k8s msa scala
Last synced: about 2 months ago
JSON representation
Build a comprehensive, event-driven online exams platform using Scala and Akka
- Host: GitHub
- URL: https://github.com/nashtech-garage/online-exams
- Owner: nashtech-garage
- License: mit
- Created: 2025-08-04T10:22:26.000Z (11 months ago)
- Default Branch: develop
- Last Pushed: 2025-09-17T02:49:20.000Z (10 months ago)
- Last Synced: 2025-09-17T04:26:36.133Z (10 months ago)
- Topics: akka, java17, k8s, msa, scala
- Language: Scala
- Homepage:
- Size: 8.66 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Online Examination System
Build a comprehensive, event-driven online exams platform using Scala and Akka
---
# Tech Stack:
- Scala 2.13
- Akka 2.9 (Akka Persistence Typed, Akka Projection, Akka HTTP)
- gRPC (Protobuf)
- Kafka (Alpakka Kafka)
- PostgreSQL
- Kubernetes (Helm)
# Architectural Goals
- **Scalability**: Handle thousands of concurrent exams and millions of messages.
- **Resilience**: Isolate failure domains per service using Akka clustering & supervision.
- **Event-driven**: Use event sourcing and projection patterns for traceability and state recovery.
- **Real-time interaction**: Provide live chat and reminder mechanisms using Akka Streams & Kafka.
- **Maintainability**: Align with Microservices principles and domain-driven design.
# System Decomposition
The system is divided into independent bounded contexts, each implemented as a microservice:
| Service Name | Responsibilities |
| ------------------------ | -------------------------------------------------- |
| **ExamService** | Create/manage exams and exam content |
| **RoomService** | Create/assign exam rooms, manage time and capacity |
| **ScheduleService** | Manage exam slots, assign students & invigilators |
| **AccessControlService** | Enforce rules on access timing, submission limits |
| **SubmissionService** | Handle exam submissions and validations |
| **ReminderService** | Trigger automated alerts before exams end |
| **ChatService** | Real-time messaging during exams |
| **NotificationService** | Deliver reminders, notifications via email/sms |
| **UserService** | Manage user profiles and roles |
Each service communicates via **gRPC (internal)** and exposes APIs via **Akka HTTP** for external integration.
# Communication and Integration
- **Intra-Service**:
- **gRPC** for synchronous communication between microservices using Protobuf contracts.
- **Akka Cluster Sharding** (if scaling horizontally within a service)
- **Event Bus**:
- Kafka (Alpakka Kafka) used for:
- Emitting domain events (e.g., ExamCreated, StudentJoinedRoom, ExamSubmitted)
- Cross-service coordination (e.g., RoomFullEvent -> triggers ReminderService)
- **External Interfaces**:
- Akka HTTP for RESTful APIs (admin panel, student portal, invigilator UI)
- WebSockets (via Akka Streams) for live chat and event push
# Persistence & Event Sourcing
Each service with state will be modeled using **Akka Persistence Typed**, backed by:
- **PostgreSQL** for journal and snapshots (via Akka Persistence JDBC plugin)
- **Akka Projection** to:
- Build read-side views (e.g., upcoming exams, chat history)
- Trigger side effects (e.g., sending reminders, audit logs)
# Rules & Time Constraints
Enforced by `AccessControlService`
| Rule | Mechanism |
| --------------------------------------- | ------------------------------------------------ |
| No access after 50% of exam duration | Akka Timer + Durable State |
| No submission after 5 minutes post exam | Akka Timer + Scheduler |
| No download after 15 minutes | Akka Scheduler + Event time constraint |
| Reminder at 15 mins before end | Kafka Event -> Projection -> NotificationService |
# Deployment & DevOps
- **CI/CD**: GitHub Actions + Helm Charts
- **Kubernetes**: Minikube or k3d for local development
- Deploy each service as a separate pod
- Use StatefulSets for services with state (e.g., ExamService, SubmissionService)
- Use ConfigMaps and Secrets for configuration management
- **Observability**:
- Prometheus + Grafana for metrics
- ELK Stack (Elasticsearch, Logstash, Kibana) for logging
- Akka Telemetry / Lightbend Console (optional)
- **Secrets & Configs**:
- Secret Manager + Kubernetes ConfigMaps
# Data Flow Example – Live Exam Session
1. `ScheduleService` emits `ExamSlotStarted`
1. `AccessControlService` activates access window
1. Students login → `AccessControlService` checks eligibility
1. Students download exam (Akka HTTP or streaming)
1. Live chat via `ChatService` (WebSocket + Akka Stream)
1. Reminder triggered by `ReminderService` via Kafka
1. Students submit → `SubmissionService` persists & validates
1. Post exam: results processed asynchronously via Kafka + Projections
# Design Patterns
* **Event Sourcing** (Akka Persistence)
* **CQRS** (Write via persistent actor, read via projections)
* **Backpressure & Streaming** (Akka Streams)
* **Cluster Sharding** (for scale-out stateful actors)
* **gRPC + Protobuf** (Strong API contracts)
* **Saga Pattern** (for complex workflows like submission + grading)