How jjems/awesomebros-travel works
Project type and purpose
• This is a Spring Boot–based monolithic backend service (“awesomebros-travel”) exposing RESTful endpoints for Posts and Users.
• It uses Spring Security for auth, MyBatis for persistence mapping, and a layered architecture (Controller → Service → Mapper → Database).
File structure
• Top-level build files (build.gradle, settings.gradle, gradle wrapper, GitHub Actions workflow) indicate a Gradle-powered Java CI/CD pipeline.
• src/main/java/com/trip_gg:
• config: Spring Security configuration
• controller: REST controllers (PostController, UserController)
• service: business logic (PostService, UserService)
• mapper: MyBatis interfaces mapping domain to SQL (plus XML files in resources/mapper)
• domain: entity classes (Post, User)
• dto: request/response payload definitions
• src/main/resources/application.yml: application config (DB connection, security, etc.)
• src/test: unit/integration tests
Main components and their interactions
a. Client(s)
• Could be a web/mobile front end or external service invoking the REST API.
b. API Layer (Controller)
• Receives HTTP requests → delegates to Service.
c. Service Layer
• Contains business rules; orchestrates calls to mappers.
d. Persistence Layer (MyBatis Mappers + XML)
• Executes SQL against the relational database.
e. Database
• Relational store (e.g., MySQL, PostgreSQL) for User and Post tables.
f. Security Layer
• Spring Security filters intercept incoming requests, enforce auth/roles before Controller.
g. CI/CD Pipeline
• GitHub Actions workflow (sync-to-team.yml) triggers build/tests on push.
Architectural patterns and design principles
• Layered (n-tier) architecture: clear separation of concerns.
• DTO pattern: decoupling internal domain model from external API contract.
• Mapper pattern (MyBatis): SQL and object mapping externalized in XML.
• Spring’s Dependency Injection: loose coupling between layers.
How to represent relationships and data flow
• Client → API Gateway/Controllers (HTTP request)
• Controllers → Services (method calls)
• Services → Mappers (MyBatis interface calls)
• Mappers → Database (SQL execution)
• Database → Mappers → Services → Controller → Client (response flow)