How elmo-riyani/cst8922_backend works
Project type and purpose
• This is a monolithic Spring Boot–based REST API (Java/Maven) that provides user authentication (signup, login), project and tag management, and validation workflows.
• It uses Spring MVC for controllers, Spring Security for auth, Spring Data JPA for persistence, Flyway for database migrations, and MySQL as the backing store.
File structure
• Top-level build and config: pom.xml, Maven wrapper, GitHub Actions workflow for Azure-MySQL deployment.
• src/main/java/com/algonquincollege/team7:
– Controllers (HTTP endpoints)
– DTOs (request/response models)
– Infra: exception handling, security configuration (CorsConfig, SecurityConfiguration)
– Model: JPA entities (User, Project, Tag, Validation, etc.)
– Repository: Spring Data interfaces
– Service: business logic and token management (AuthenticationService, TokenService, etc.)
• src/main/resources: application.properties, .env, and Flyway migrations under db/migration.
• Test harness under src/test.
Main components and interactions
a. External Client(s)
– Browser or mobile app calling the API over HTTP(S)
b. API Server (Spring Boot application)
– Security Module: CORS filter, JWT authentication filter, SecurityConfiguration
– Controllers: LoginController, SignupController, ProjectController, TagController, etc.
– Service Layer: AuthenticationService, ProjectService, TagService, ValidationService, TokenService
– Data Access Layer: Repositories (UserRepository, ProjectRepository, etc.)
c. Database
– MySQL, initialized via Flyway (V1–V4 migrations)
d. CI/CD (outside runtime)
– GitHub Actions workflow for building and deploying to Azure MySQL
Data-flow example (Login):
Client → HTTP POST /login → Spring Security filter → LoginController → AuthenticationService → UserRepository → MySQL → TokenService issues JWT → LoginResponse → Client
Architectural patterns and design principles
• Layered architecture: Presentation (Controllers/DTOs), Business (Services), Data (Repositories, Models)
• MVC-style REST controllers
• Repository pattern via Spring Data JPA
• Dependency Injection (Spring IoC)
• Global exception handling with @ControllerAdvice (ErrorHandler)
• Secure by default: JWT tokens, CORS configuration
– Security Layer (CorsConfig, SecurityConfiguration)
– Controllers (seven controllers handling REST endpoints)
– Service Layer (business logic, token generation)
– Data Layer (Repositories + Domain Models)
– Client → Security Layer → Controllers → Services → Repositories → Database
– Indicate TokenService inside Services issuing JWT back to Client
e. Outside of runtime, show “GitHub Actions CI” connecting to Azure MySQL in deployment.