How one-bite/one-bite-be works
Main Components
• Backend Application:
• SpaghettiApplication as the central container running the Spring Boot application.
• TestDataLoader, which helps bootstrapping sample data.
• Controllers:
• OAuthController, ProblemController, and TestController handling incoming HTTP requests.
• Authentication & Security Module:
• Components such as JwtAuthenticationFilter, SecurityConfig, JwtProvider, and related DTOs (JwtTokenDto, LoginRequest, LoginProvider).
• Problem Management Module:
• ProblemService and ProblemController for managing problem creation and solving (including request/response DTOs and Problem entities).
• Data Persistence:
• Repository components (UserRepository, ProblemRepository, etc.) interacting with your underlying database.
• Entities (User, Problem, Badge, etc.) representing data models.
• Caching and External Configurations:
• RedisConfig and RedisService, indicating integration with a Redis cache.
• Exception Handling:
• GlobalExceptionHandler and custom exceptions (InvalidRequestException, ProblemNotFoundException, etc.).
• Configuration & Third-Party Integrations:
• SwaggerConfig for API documentation.
• GoogleLoginService for OAuth integration.
• External OAuth providers (e.g., Google or other configured providers) illustrated as external systems.
Relationship and Interaction Flows
• Client/API Gateway:
• Request Routing:
• Requests come into the appropriate controllers (authentication requests to OAuthController, problem-related requests to ProblemController).
• Service Layer:
• Data and Caching:
• Also, indicate interactions with Redis (via RedisService/RedisConfig) for caching or session data.
• Security Workflow:
• JWT-based authentication by showing the JwtAuthenticationFilter intercepting requests before they reach controllers.
• Relationship between the AuthenticationFilter, SecurityConfig, and JwtProvider.
• Exception Handling:
• GlobalExceptionHandler as an overarching component that captures and processes errors or invalid requests.
Architectural Patterns and Design Principles
• Layered Architecture (MVC/Service/Repository):
• Clearly separate the presentation layer (controllers), business logic (services), and data access (repositories/entities).
• Security as a Cross-Cutting Concern:
• Detail how authentication and authorization components (JWT, filters, security configurations) integrate at every layer.
• Integration with External Services:
• OAuth integration through the OAuthController and GoogleLoginService along with their connection to external OAuth providers.
• Use of Containerization/Orchestration:
Technologies, Frameworks, and Libraries
• Java with Spring Boot (evident from build.gradle and the Spring application structure).
• Security with JWT and OAuth integrations.
• Redis for caching.
• Swagger for API documentation.
• Gradle as the build tool.
Final Assembly
• Drill down into layers showing how requests pass through filters and controllers into services and repositories.
• Integrate external components (like OAuth providers and Redis) in the context of their interaction(s) with the main application.