Skip to content

RIDECI/NEMESIS_TRAVEL_MANAGEMENT_BACKEND

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

104 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Nemesis - Travel Management Backend

This module is designed to manage travels within the RideCi ecosystem: it creates, updates, lists and deletes trips, handles their status (e.g. CREATED, IN_PROGRESS, COMPLETED, CANCELED) and exposes this information to other microservices.

πŸ‘₯ Developers

  • Santiago Carmona Pineda
  • Tulio RiaΓ±o Sanchez
  • Daniel PatiΓ±o Mejia
  • Juan Felipe Rangel Rodriguez

πŸ“‘ Content Table

  1. Project Architecture
  2. API Documentation
  3. Input & Output Data
  4. Microservices Integration
  5. Technologies
  6. Branch Strategy
  7. System Architecture & Design
  8. Getting Started
  9. Testing

πŸ›οΈ Project Architecture

The Nemesis - Travel Management backend follows a decoupled hexagonal / clean architecture that isolates the business logic from infrastructure and external services by splitting the code into multiple components:

  • 🧠 Domain (Core): Contains the travel entities, value objects, enums (Status, TravelType) and the core business rules.

  • 🎯 Ports (Interfaces): Interfaces that define which operations the domain can perform (use cases exposed as input ports and required external interactions as output ports).

  • πŸ”Œ Adapters (Infrastructure): Implementations of the ports that connect the domain with technologies such as HTTP controllers, MongoDB persistence and RabbitMQ.

Main benefits of this architecture:

  • βœ… Separation of Concerns: Clear limits between business logic and infrastructure.
  • βœ… Maintainability: Easier to modify or replace specific components.
  • βœ… Scalability: Components can evolve and scale independently.
  • βœ… Testability: The domain can be tested in isolation without database or web server.

πŸ“‚ Clean - Hexagonal Structure

πŸ“‚ nemesis_travel_management_backend
 ┣ πŸ“‚ src/
 ┃ ┣ πŸ“‚ main/
 ┃ ┃ ┣ πŸ“‚ java/
 ┃ ┃ ┃ β”— πŸ“‚ edu/dosw/rideci/
 ┃ ┃ ┃   ┣ πŸ“„ NemesisTravelManagementBackendApplication.java
 ┃ ┃ ┃   ┣ πŸ“‚ domain/
 ┃ ┃ ┃   ┃ β”— πŸ“‚ model/            # 🧠 Domain models (Travel, Location, enums)
 ┃ ┃ ┃   ┣ πŸ“‚ application/
 ┃ ┃ ┃   ┃ ┣ πŸ“‚ events/           # πŸ“‘ Domain events (TravelCreatedEvent, TravelCompletedEvent)
 ┃ ┃ ┃   ┃ ┣ πŸ“‚ mapper/           # πŸ”„ Mappers between domain and infrastructure DTOs
 ┃ ┃ ┃   ┃ ┣ πŸ“‚ port/
 ┃ ┃ ┃   ┃ ┃ β”— πŸ“‚ in/             # 🎯 Input ports (use case interfaces)
 ┃ ┃ ┃   ┃ β”— πŸ“‚ service/          # βš™οΈ Use case implementations (TravelService)
 ┃ ┃ ┃   ┣ πŸ“‚ exceptions/         # ❗ Custom domain/infrastructure exceptions
 ┃ ┃ ┃   ┣ πŸ“‚ infrastructure/
 ┃ ┃ ┃   ┃ ┣ πŸ“‚ config/           # βš™οΈ Spring / Infra configuration (OpenAPI, RabbitMQ)
 ┃ ┃ ┃   ┃ ┣ πŸ“‚ controller/
 ┃ ┃ ┃   ┃ ┃ ┣ πŸ“„ TravelController.java   # 🌐 REST controllers
 ┃ ┃ ┃   ┃ ┃ β”— πŸ“‚ dto/                   # πŸ“¨ Request / Response DTOs
 ┃ ┃ ┃   ┃ ┃   ┣ πŸ“‚ Request/
 ┃ ┃ ┃   ┃ ┃   β”— πŸ“‚ Response/
 ┃ ┃ ┃   ┃ β”— πŸ“‚ persistance/
 ┃ ┃ ┃   ┃   ┣ πŸ“‚ Entity/          # πŸ—„οΈ MongoDB documents (TravelDocument, LocationDocument)
 ┃ ┃ ┃   ┃   ┣ πŸ“‚ Repository/      # 🧰 Spring Data repositories & adapters
 ┃ ┃ ┃   ┃   ┃ ┣ πŸ“„ TravelRepository.java
 ┃ ┃ ┃   ┃   ┃ ┣ πŸ“„ TravelRepostoryAdapter.java
 ┃ ┃ ┃   ┃   ┃ β”— πŸ“„ RabbitEventPublisher.java
 ┃ ┃ β”— πŸ“‚ resources/
 ┃ ┃   β”— πŸ“„ application.properties
 ┣ πŸ“‚ test/
 ┃ ┣ πŸ“‚ java/
 ┃ ┃ β”— πŸ“‚ edu/dosw/rideci/
 ┃ ┃   ┣ πŸ“„ NemesisTravelManagementBackendApplicationTests.java
 ┃ ┃   ┣ πŸ“‚ Adapter/
 ┃ ┃   ┃ β”— πŸ“„ TravelRepositoryAdapterTest.java
 ┃ ┃   β”— πŸ“‚ Controller/
 ┃ ┃     β”— πŸ“„ TravelControllerTest.java
 ┣ πŸ“‚ docs/
 ┃ ┣ diagramaCasosUso.png
 ┃ ┣ diagramaClases.jpg
 ┃ ┣ diagramaComponentes.png
 ┃ ┣ diagramaContexto.png
 ┃ ┣ diagramaDatos.jpg
 ┃ β”— diagramaDespliegue.png
 ┣ πŸ“„ pom.xml
 ┣ πŸ“„ mvnw / mvnw.cmd
 β”— πŸ“„ README.md

πŸ“‘ API Endpoints

For detailed documentation refer to Swagger UI (running locally at http://localhost:8080/swagger-ui.html).

Below is a summary of the main REST endpoints exposed by TravelController (base path may vary, e.g. /api/v1/travels).

Note: Adjust the exact URIs if your controller mapping differs.

Method URI Description Request Body / Params
POST /api/v1/travels Creates a new travel TravelRequest (JSON)
GET /api/v1/travels Retrieves all travels β€”
GET /api/v1/travels/{id} Retrieves a travel by ID id (Path Variable)
PUT /api/v1/travels/{id} Modifies an existing travel id + TravelRequest (JSON)
PATCH /api/v1/travels/{id}/status Changes the status of a travel id + new status (e.g. query/body)
GET /api/v1/travels/{id}/passengers Gets passenger list for a travel id (Path Variable)
DELETE /api/v1/travels/{id} Deletes a travel by ID id (Path Variable)

πŸ“Ÿ HTTP Status Codes

Common status codes returned by the API.

Code Status Description
200 OK Request processed successfully.
201 Created Travel created successfully.
204 No Content Travel deleted successfully.
400 Bad Request Invalid data or missing parameters.
404 Not Found Travel ID does not exist.
500 Internal Server Error Unexpected error on server side.

Input and Output Data

Data information per functionality (simplified overview):

  • TravelRequest (Input)

    • origin (LocationRequest)
    • destination (LocationRequest)
    • travelType (e.g. ONE_WAY, ROUND_TRIP)
    • departureTime
    • Optional passenger info depending on design
  • TravelResponse (Output)

    • id
    • origin / destination (LocationResponse)
    • status (from Status enum)
    • travelType
    • createdAt / updatedAt
    • Additional travel details
  • LocationRequest / LocationResponse

    • Coordinates or semantic location data used by travels.

You can inspect LocationRequest, LocationResponse, TravelRequest and TravelResponse classes under infrastructure/controller/dto for full details.

πŸ”— Connections with other Microservices

This module is part of the RideCi ecosystem and typically interacts with other services via REST and message broker (RabbitMQ):

  1. Routes & Tracking Module: May consume travel events (TravelCreatedEvent, TravelCompletedEvent) to start or stop geolocation tracking.
  2. Profiles / Passengers Module: Provides passenger data associated with a travel.
  3. Notifications Module: Sends alerts related to travel state changes (start, completion, cancellation, etc.).

Technologies

The following technologies were used to build and deploy this module:

Backend & Core

Java Spring Boot Maven

Database

MongoDB

DevOps & Infrastructure

Docker Kubernetes Railway Vercel

CI/CD & Quality Assurance

GitHub Actions SonarQube JaCoCo

Documentation & Testing

Swagger Postman

Design

Figma

Comunication & Project Management

Jira Slack

🌿 Branches Strategy & Structure

This module follows a strict branching strategy based on Gitflow to ensure the ordered versioning, code quality and continuous integration.

Branch Purpose Receive of Sent to Notes
main 🏁 Stable code for preproduction or Production release/*, hotfix/* πŸš€ Production πŸ” Protected with PR y successful CI
develop πŸ§ͺ Main developing branch feature/* release/* πŸ”„ Base to continuous deployment
feature/* ✨ New functions or refactors to be implemented develop develop 🧹 Are deleted after merge to develop
release/* πŸ“¦ Release preparation & final polish. develop main y develop πŸ§ͺ Includes final QA. No new features added here.
bugfix/* o hotfix/* πŸ› οΈ Critical fixes for production main main y develop ⚑ Urgent patches. Highest priority

🏷️ Naming Conventions

🌿 Branch Naming

✨ Feature Branches

Used for new features or non-critical improvements.

Format: feature/[shortDescription]

Examples:

  • feature/authenticationModule
  • feature/securityService

Rules:

  • 🧩 Case: strictly camelCase (lowercase with hyphens).
  • ✍️ Descriptive: Short and meaningful description.

πŸ“¦ Release Branches

Used for preparing a new production release. Follows Semantic Versioning.

Format: release/v[major].[minor].[patch]

Examples:

  • release/v1.0.0
  • release/v1.1.0-beta

πŸš‘ Hotfix Branches

Used for urgent fixes in the production environment.

Format: hotfix/[shortDescription]

Examples:

  • hotfix/fixTokenExpiration
  • hotfix/securityPatch

πŸ“ Commit Message Guidelines

We follow the Conventional Commits specification.

🧱 Standard Format

<type>(<scope>): <short description>

πŸ“ System Architecture & Design

This section provides a visual representation of the module's architecture ilustrating the base diagrams to show the application structure and components flow.

🧩 Context Diagram


Context Diagram

🧩 Specific Components Diagram


This diagram visualizes the dependencies between classes for developing the module's logic. It includes the following components:

  • Controllers:
    • Travel Management Controller: This controller receives and manages all requests related to travels, including references handled via DTOs.

When applying a hexagonal architecture, before developing the use cases, we need adapter components:

  • Adapter:

    • Travel Adapter: Contracts (interfaces) are defined based on the input received from the controllers.

    • Mapper Adapter: This adapter transforms data types from one object to another for use in the respective use cases.

  • Use Cases:

    • Create Travel Use Case: Implementation to create new travels.

    • Modify Travel Use Case: Update data for an existing travel.

    • Change State Travel Use Case: Change the travel status during its lifecycle.

    • Get Travel Use Case: Retrieve information about a specific travel.

    • Get All Travel Use Case: Retrieve a list of all travels.

    • Get Passenger List Use Case: Retrieve the passenger list for a travel.

    • Delete Travel Use Case: Delete a travel.

  • Ports: The following interfaces were defined as the data we will receive from the outside:

    • Port Notifications

    • Port Profiles

    • Port Travel Information

Specific Components Diagram

🧩 Use Cases Diagram


This diagram presents the main functionalities defined by each actor. This facilitates a better understanding when implementing the module's multiple functions, as well as identifying and separating each actor's roles when using the application.

Use Cases Diagram

🧩 Class Diagram


Based on the Specific Components diagram, we created the class diagram, where we defined an Observer design pattern that will notify all passengers already registered on the trip, allowing them to view information related to the travel.

Class Diagram

🧩 Data Base Diagram


This diagram represents how the data is stored, where we will find the multiple documents, and the data that will be stored in an embedded or referenced manner.

Data Base Diagram

🧩 Specific Deploy Diagram


This diagram illustrates the cloud deployment architecture and workflow of the travel management module. Specific Deploy Diagram

πŸš€ Getting Started

This section guides you through setting up the project locally. This project requires Java 17. If you have a different version, you can change it or we recommend using Docker to ensure compatibility before compiling.

Clone & open repository

git clone https://github.com/RIDECI/NEMESIS_TRAVEL_MANAGEMENT_BACKEND.git
cd NEMESIS_TRAVEL_MANAGEMENT_BACKEND

You can open it in your favorite IDE.

Dockerize the project

Dockerizing before compiling the project avoids configuration issues and ensures environment consistency.

docker compose up -d

Install dependencies & compile project

Download dependencies and compile the source code.

mvn clean install
mvn clean compile

To run the project

Start the Spring Boot server

mvn spring-boot:run

πŸ§ͺ Testing

Testing is an essential part of the project functionality; this section will show the code coverage and code quality analyzed with tools like JaCoCo and Sonar.

πŸ“Š Code Coverage (JaCoCo)


JaCoCo

πŸ” Static Analysis (SonarQube)

SonarQube

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors