# dsvasudev19/capstone-project architecture

> Architecture diagram of the GitHub repository dsvasudev19/capstone-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dsvasudev19/capstone-project
- Repository: https://github.com/dsvasudev19/capstone-project

## Overview

##### Main components
- API Gateway – Serves as the single entry point for all client requests, handling routing, load-balancing, and authentication.
- Service Registry (Netflix Eureka) – Registers all microservices and enables dynamic discovery.
- Authentication Service – A dedicated service to secure and validate incoming API requests using JWT tokens.
- Carpool Service
- Bus Service (including live bus tracking with integration to Ola Maps)
- User Management Service
- Operator Management Service (if distinct)
- Route Service (for route optimization and planning)
- Notification Service (to push alerts and status updates)
- Feedback Service (to handle feedback submission)
- Payment Service (handling transactions and external payment integrations)
- External integrations – Show connections to PostgreSQL (as the database) and to external services like Ola Maps, plus any third-party payment gateways.
- Frontend – Represent the UserInterface (which appears to use Angular, while the README also mentions React as an optional UI); this communicates with the API Gateway.

##### Relationships and interactions
- Data flow from the client (frontend application) hitting the API Gateway.
- Bi-directional or one-way interactions between microservices and the Service Registry, which supports dynamic discovery.
- Microservice with its respective data source showing interactions with PostgreSQL instances.
- For live bus tracking, show the Bus Service’s integration with Ola Maps.

##### Architectural patterns and design principles
- Microservices Architecture: Note the separation of concerns by having each business function (authentication, bus scheduling, route planning, etc.) implemented in its own independent service.
- API Gateway pattern: Emphasize the single access point for external requests that also integrates centralized authentication.
- Service discovery using Netflix Eureka.
- Containerization and orchestration potential by including Docker (and optionally Kubernetes if scaled).

##### Technologies
- Backend: Spring Boot, Spring Cloud, Spring Security, Spring Data JPA, PostgreSQL, Docker.
- Communication: RESTful APIs with JWT-based authentication.
- External Services: Ola Maps integration for real-time bus tracking.
- Frontend: Modern JavaScript frameworks (Angular for the UserInterface in this codebase, with React as an optional mention).
- Infrastructure: Docker & possible Kubernetes orchestration.

- Network infrastructure components (API Gateway, Service Registry)
- Optionally, group components belonging to similar functions (e.g., core transit functions vs. authentication/security).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        UI["User Interface"]:::client
    end

    %% Gateway and Discovery Layer
    subgraph "Gateway and Discovery Layer"
        APIGW["API Gateway"]:::network
        SR["Service Registry (Eureka)"]:::network
    end

    %% Security Service
    subgraph "Security Service"
        Auth["Authentication Service"]:::security
    end

    %% Core Microservices
    subgraph "Core Microservices"
        CP["Carpool Service"]:::service
        BS["Bus Service"]:::service
        US["User Management Service"]:::service
        RS["Route Service"]:::service
        NS["Notification Service"]:::service
        FS["Feedback Service"]:::service
        PS["Payment Service"]:::service
    end

    %% External Integrations
    subgraph "External Integrations"
        PG["PostgreSQL"]:::database
        OM["Ola Maps"]:::external
    end

    %% Relationships
    UI -->|"request"| APIGW
    APIGW -->|"authCheck"| Auth
    APIGW -->|"routeReq"| CP
    APIGW -->|"routeReq"| BS
    APIGW -->|"routeReq"| US
    APIGW -->|"routeReq"| RS
    APIGW -->|"routeReq"| NS
    APIGW -->|"routeReq"| FS
    APIGW -->|"routeReq"| PS

    CP -->|"register"| SR
    BS -->|"register"| SR
    US -->|"register"| SR
    RS -->|"register"| SR
    NS -->|"register"| SR
    FS -->|"register"| SR
    PS -->|"register"| SR

    BS -->|"liveTracking"| OM

    CP -->|"persist"| PG
    BS -->|"persist"| PG
    US -->|"persist"| PG
    RS -->|"persist"| PG
    NS -->|"persist"| PG
    FS -->|"persist"| PG
    PS -->|"persist"| PG

    %% Click Events
    click APIGW "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/api-gateway/src/main/java/com/project/api_gateway/ApiGatewayApplication.java"
    click SR "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/service-registry/src/main/java/com/project/service_registry/ServiceRegistryApplication.java"
    click Auth "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/authentication-service/src/main/java/com/project/authentication_service/AuthenticationServiceApplication.java"
    click CP "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/carpool-service/src/main/java/com/capstone/carpool_service/CarpoolServiceApplication.java"
    click BS "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/bus-service/src/main/java/com/capstone/bus_service/BusServiceApplication.java"
    click US "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/user-service/src/main/java/com/capstone/user_service/UserServiceApplication.java"
    click RS "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/route-service/src/main/java/com/capstone/route_service/RouteServiceApplication.java"
    click NS "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/notification-service/src/main/java/com/capstone/notification_service/NotificationServiceApplication.java"
    click FS "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/feedback-service/src/main/java/com/capstone/feedback_service/FeedbackServiceApplication.java"
    click PS "https://github.com/dsvasudev19/capstone-project/blob/main/Backend/payment-service/src/main/java/com/project/payment_service/PaymentServiceApplication.java"
    click UI "https://github.com/dsvasudev19/capstone-project/blob/main/UserInterface/src/app/app.module.ts"

    %% Styles
    classDef client fill:#ADD8E6, stroke:#000, stroke-width:2px;
    classDef network fill:#FFD700, stroke:#000, stroke-width:2px;
    classDef security fill:#FF6347, stroke:#000, stroke-width:2px;
    classDef service fill:#90EE90, stroke:#000, stroke-width:2px;
    classDef database fill:#FFB6C1, stroke:#000, stroke-width:2px;
    classDef external fill:#D3D3D3, stroke:#000, stroke-width:2px;
```
