How engineerscodes/amba works
Main Components
a. Frontend/Client (even though not in the repository, the README mentions admin pages hosted on localhost:4200, indicating that there is an external client application).
b. API Layer (Controllers): Represented by the controllers under src/main/java/org/amba/app/Controllers (AdminController, AuthenticationController, BatchUploadController, ProjectController, etc.).
c. Service Layer: The business logic components in src/main/java/org/amba/app/Service (AuthenticationService, BatchUploadService, QuestionService, ReportService, UserService).
d. Data Access Layer: The repository classes under src/main/java/org/amba/app/Repo and the associated entities under src/main/java/org/amba/app/Entity.
e. Messaging Component: The RabbitMQ integration represented by RabbitClient and RabbitMQConfig, indicating asynchronous messaging.
f. Scheduled Tasks: The cron jobs located in src/main/java/org/amba/app/Crons (ReportScheduler and its associated DTOs).
g. Database: PostgreSQL (as per the SQL script in the README and configuration in application.properties).
h. Infrastructure/DevOps: Dockerfile, docker-compose.yaml, AWS and Azure workflow configurations, and AWS infra definition indicating container orchestration and CI/CD pipelines.
Relationships and Interactions
• The API layer (controllers) receives HTTP requests from the external client (frontend) and passes these requests to the service layer.
• Services encapsulate the business logic, interact with the data repositories to perform CRUD operations on the PostgreSQL database, and utilize messaging for asynchronous tasks.
• The messaging component (RabbitMQ) is used to decouple processes (e.g., handling question uploads or audit events) by sending and receiving messages via queues.
• Cron jobs are set up to periodically run scheduled tasks (such as generating reports) and may interact with both the service and repository layers.
• Security configurations (i.e., JWT-based authentication) ensure that only authenticated users can access certain API endpoints.
• The containerization and CI/CD pipelines indicate that this backend service can be deployed in Docker containers on AWS or Azure.
Architectural Patterns and Design Principles
• Layered Architecture (Separation between controllers, services, repositories, and messaging components).
• Use of Data Transfer Objects (DTO) for exposing and transferring data (e.g., AuthenticationResponseDTO, ProjectDto, etc.).
• Asynchronous Communication via RabbitMQ for decoupling.
• Scheduled job execution using Cron jobs.
• Security via JWT with a dedicated filter, configuration, and service.
• Containerization and Infrastructure as Code components for deployment automation.