How pedro0402/planner works
Project Type and Purpose
• This is a backend-only RESTful service (“Planejador de Viagens”) written in Java 17+ with Spring Boot.
• It exposes HTTP endpoints to manage users (participants), trips, activities and links, persisting data in MySQL.
• Flyway handles database migrations on startup.
File Structure
• Top‐level “planner” module with Maven wrapper, pom.xml, src and src/main/resources.
• Under src/main/java/com/rocketseat/planner:
• Four feature‐based packages: participant, trip, activity, link. Each contains:
– Entity class (*.java)
– Data (DTO) classes (*Data.java)
– Request/Response payload classes
– Repository interfaces (Spring Data JPA)
– Service classes
– Controllers (only in participant and trip packages)
• Database migrations in src/main/resources/db/migration (V1..V4 SQL scripts).
• application.properties configures the datasource and JPA.
• Tests under src/test/java.
Key Insights from README
• Uses Spring Boot, Spring Data JPA, MySQL, Maven.
• Exposes endpoints for users (/usuarios) and trips (/viagens).
• Planned future layers: authentication (JWT), favorites, recommendations, cloud deploy.
Main Architectural Components
a. API Layer
• Spring MVC Controllers (ParticipantController, TripController)
b. Service Layer
• Business logic in *Service classes for each domain (participant, trip, activity, link)
c. Persistence Layer
• Spring Data JPA Repositories
• Entities managed via Hibernate
• Flyway migration scripts
d. Database
• MySQL instance with tables: trips, participants, activities, links
e. External Tools
• Flyway (migration)
• Postman (for testing)
• Maven (build management)
Relationships and Data Flow
• Client → HTTP request → Controller
• Controller calls Service (business rules)
• Service delegates to Repository (CRUD ops)
• Repository ↔ MySQL database
• Flyway executes SQL scripts on application startup before repositories run
• Test suite hits Controllers or Services for integration/unit tests
Architectural Patterns & Principles
• Layered architecture (Controller → Service → Repository)
• Domain‐driven package structure (feature‐based grouping)
• RESTful API design
• Separation of concerns (DTOs vs Entities)
• Database migrations with Flyway