# jhojan98/urbanrideproject architecture

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

- Interactive diagram: https://gitdiagram.com/jhojan98/urbanrideproject
- Repository: https://github.com/jhojan98/urbanrideproject

## Overview

##### Project type and purpose
- This is a full-stack, containerized, microservices-based “urban ride/mobility” platform (“UrbanRideProject”).
- It uses two polyglot stacks in parallel:
– A Python-based API Gateway + microservices suite (under `gateway/` and `microservices/`)
– A Java/Spring Boot microservices ecosystem (under `movilidad-sostenible/`)
- A Vue.js single-page application (SPA) serves as the user interface (`frontend/client/`).
- The system relies on Docker / docker-compose for local orchestration, RabbitMQ for messaging, and PostgreSQL (Flyway migrations) for persistence.

##### Top-level directories and architectural clues
- `frontend/client/` – Vue.js SPA, built via Nginx (Dockerfile), includes router, stores, composables, components, views.
- `gateway/` – Python API gateway (Flask/FastAPI?) handling incoming REST, using `rpc_client.py` to delegate calls to Python microservices.
- `microservices/` – Python microservices:
– auth, bicycle, notification_service, payments (placeholder), users
– each with Dockerfile, Alembic migrations, SQLAlchemy models, service layer, schemas, publishers/subscribers.
- `movilidad-sostenible/` – Java Spring Boot ecosystem with:
– service registry (Eureka Server), API gateway (Spring Cloud Gateway), database-migrator (Flyway), and individual services: bicis, ciudad, estaciones, email, usuario, viaje.
– Each Java service is a standard Maven project (controller → service → repository → entity), configured via `application.properties`, produces OpenAPI docs, uses RabbitMQ for event-driven flows.
- `docker-compose.yml` at root orchestrates containers for Python stack (gateway, microservices, RabbitMQ, Postgres).
- `movilidad-sostenible/docker-compose.yaml` + `deployment-*.yaml` orchestrates Java/Spring Boot cluster, RabbitMQ, Postgres in Kubernetes.
- `BD/` holds standalone SQL scripts and DB design files (for initial reference).

##### README
- Minimal (“# UrbanRideProject”).

a. Frontend layer
– Browser / User → Vue.js SPA (served by Nginx)
b. Gateway layer (two parallel flavors)
– Python API Gateway container
– Java Spring Cloud Gateway (movilidad-sostenible/gateway-server)
c. Service discovery (Java only)
– Eureka Server
– Python services: auth, bicycle, notification, payments, users
– Java services: bicis-service, ciudad-service, estaciones-service, email-service, usuario-service, viaje-service
– Database-migrator (Flyway) as an init container or startup job
e. Messaging / Event bus
– RabbitMQ cluster (used by both stacks for pub/sub between services, e.g., user-created → email-verification)
f. Persistence layer
– PostgreSQL (separate databases or schemas per service; initialized via scripts under `BD/` or Flyway in each Java service)

##### Relationships and data flow
- API Gateway → Service Registry (Java) to locate services.
- API Gateway → Direct calls to Python microservices via RPC client.
- Microservices ↔ Postgres (per-service DB).
- Microservices ↔ RabbitMQ (publish/subscribe events).
- Email service ← user-verification event.
- Journey service uses both User and Bicycle clients (HTTP calls or messaging).

##### Architectural patterns & design principles
- Microservices (one bounded context per service).
- API Gateway pattern (Python and Spring Cloud).
- Service Discovery (Eureka for Java).
- Containerized deployment (Docker Compose + Kubernetes YAML).
- Event-driven architecture (RabbitMQ).
- CI/CD / DB migrations (Flyway / Alembic).

##### Call out key technologies & frameworks
- Frontend: Vue.js, Vue Router, Pinia stores, SCSS, Nginx
- Python: FastAPI/Flask (gateway), SQLAlchemy, Alembic, Pydantic schemas
- Java: Spring Boot, Spring Cloud Gateway, Eureka, Spring Data JPA, Flyway, Maven
- Messaging: RabbitMQ
- Data: PostgreSQL
- Infrastructure: Docker, Docker Compose, Kubernetes manifests

##### Final checklist
– Every container / service in your file tree should appear.
– Clearly separate Python vs. Java ecosystems if both are running concurrently.
– Highlight initialization steps (DB-migrator, Alembic, Flyway).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Frontend Layer
    Browser["Browser / User"]:::frontend
    Nginx["Vue.js SPA (Nginx)"]:::frontend
    Browser -->|"access SPA"| Nginx
    click Nginx "https://github.com/jhojan98/urbanrideproject/tree/main/frontend/client/"

    %% API Gateways
    subgraph "API Gateways"
        PYGW["Python API Gateway\n(FastAPI/Flask)"]:::gateway
        JAGW["Java API Gateway\n(Spring Cloud Gateway)"]:::gateway
    end
    Nginx -->|"HTTP REST"| PYGW
    Nginx -->|"HTTP REST"| JAGW
    click PYGW "https://github.com/jhojan98/urbanrideproject/blob/main/gateway/main.py"
    click PYGW "https://github.com/jhojan98/urbanrideproject/tree/main/gateway/Dockerfile"
    click PYGW "https://github.com/jhojan98/urbanrideproject/blob/main/gateway/rpc_client.py"
    click JAGW "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/gateway-server/"

    %% Service Discovery
    Eureka["Eureka Service Registry"]:::infra
    JAGW -->|"register/discover"| Eureka
    click Eureka "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/eureka-server/"

    %% Python Microservices
    subgraph "Python Microservices"
        direction TB
        Auth["auth-service\n(Python)"]:::micro
        Bicycle["bicycle-service\n(Python)"]:::micro
        Notification["notification-service\n(Python)"]:::micro
        Payments["payments-service\n(Python)"]:::micro
        Users["users-service\n(Python)"]:::micro
    end
    PYGW -->|"RPC / HTTP"| Auth
    PYGW -->|"RPC / HTTP"| Bicycle
    PYGW -->|"RPC / HTTP"| Notification
    PYGW -->|"RPC / HTTP"| Payments
    PYGW -->|"RPC / HTTP"| Users

    click Auth "https://github.com/jhojan98/urbanrideproject/tree/main/microservices/auth/"
    click Bicycle "https://github.com/jhojan98/urbanrideproject/tree/main/microservices/bicycle/"
    click Notification "https://github.com/jhojan98/urbanrideproject/tree/main/microservices/notification_service/"
    click Payments "https://github.com/jhojan98/urbanrideproject/tree/main/microservices/payments/"
    click Users "https://github.com/jhojan98/urbanrideproject/tree/main/microservices/users/"

    %% Java Microservices
    subgraph "Java Microservices"
        direction TB
        BicisJS["bicis-service\n(Java)"]:::micro
        CiudadJS["ciudad-service\n(Java)"]:::micro
        EstacionesJS["estaciones-service\n(Java)"]:::micro
        EmailJS["email-service\n(Java)"]:::micro
        UsuarioJS["usuario-service\n(Java)"]:::micro
        ViajeJS["viaje-service\n(Java)"]:::micro
        DBMigrator["Flyway Migrator\n(Java)"]:::db
    end
    JAGW -->|"HTTP REST"| BicisJS
    JAGW -->|"HTTP REST"| CiudadJS
    JAGW -->|"HTTP REST"| EstacionesJS
    JAGW -->|"HTTP REST"| EmailJS
    JAGW -->|"HTTP REST"| UsuarioJS
    JAGW -->|"HTTP REST"| ViajeJS
    click BicisJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/bicis-service/"
    click CiudadJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/ciudad-service/"
    click EstacionesJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/estaciones-service/"
    click EmailJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/email-service/"
    click UsuarioJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/usuario-service/"
    click ViajeJS "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/viaje-service/"
    click DBMigrator "https://github.com/jhojan98/urbanrideproject/tree/main/movilidad-sostenible/database-migrator/"

    %% Messaging & Event Bus
    RabbitMQ["RabbitMQ (5672)"]:::infra
    Auth -->|"publish/subscribe (AMQP)"| RabbitMQ
    Bicycle -->|"publish/subscribe (AMQP)"| RabbitMQ
    Notification -->|"publish/subscribe (AMQP)"| RabbitMQ
    Payments -->|"publish/subscribe (AMQP)"| RabbitMQ
    Users -->|"publish/subscribe (AMQP)"| RabbitMQ
    BicisJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    CiudadJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    EstacionesJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    EmailJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    UsuarioJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    ViajeJS -->|"publish/subscribe (AMQP)"| RabbitMQ
    click RabbitMQ "https://github.com/jhojan98/urbanrideproject/blob/main/movilidad-sostenible/deployment-rabbitmq.yaml"
    click RabbitMQ "https://github.com/jhojan98/urbanrideproject/blob/main/docker-compose.yml"

    %% Databases
    subgraph "PostgreSQL & Migrations"
        PGInit["SQL Init Scripts"]:::db
        Postgres["PostgreSQL"]:::db
    end
    Auth -->|"SQL"| Postgres
    Bicycle -->|"SQL"| Postgres
    Notification -->|"SQL"| Postgres
    Payments -->|"SQL"| Postgres
    Users -->|"SQL"| Postgres
    BicisJS -->|"SQL"| Postgres
    CiudadJS -->|"SQL"| Postgres
    EstacionesJS -->|"SQL"| Postgres
    EmailJS -->|"SQL"| Postgres
    UsuarioJS -->|"SQL"| Postgres
    ViajeJS -->|"SQL"| Postgres
    DBMigrator -->|"migrates"| Postgres
    click PGInit "https://github.com/jhojan98/urbanrideproject/tree/main/BD/init-db/"
    click Postgres "https://github.com/jhojan98/urbanrideproject/blob/main/movilidad-sostenible/deployment-postgres.yaml"
    click Postgres "https://github.com/jhojan98/urbanrideproject/blob/main/docker-compose.yml"

    %% Orchestration
    DockerCompose["Docker Compose\n(python stack)"]:::infra
    Kubernetes["Kubernetes Manifests\n(java stack)"]:::infra
    DockerCompose --> PYGW
    DockerCompose --> Auth
    DockerCompose --> Bicycle
    DockerCompose --> Notification
    DockerCompose --> Payments
    DockerCompose --> Users
    click DockerCompose "https://github.com/jhojan98/urbanrideproject/blob/main/docker-compose.yml"
    Kubernetes --> JAGW
    Kubernetes --> Eureka
    Kubernetes --> DBMigrator
    Kubernetes --> BicisJS
    Kubernetes --> CiudadJS
    Kubernetes --> EstacionesJS
    Kubernetes --> EmailJS
    Kubernetes --> UsuarioJS
    Kubernetes --> ViajeJS
    click Kubernetes "https://github.com/jhojan98/urbanrideproject/blob/main/movilidad-sostenible/docker-compose.yaml"
    click Kubernetes "https://github.com/jhojan98/urbanrideproject/blob/main/movilidad-sostenible/deployment-postgres.yaml"
    click Kubernetes "https://github.com/jhojan98/urbanrideproject/blob/main/movilidad-sostenible/deployment-rabbitmq.yaml"

    %% Legend
    subgraph "Legend"
        direction LR
        F[Frontend Layer]:::frontend
        G[API Gateway]:::gateway
        M[Microservice]:::micro
        I[Infrastructure]:::infra
        D[Database/Migrations]:::db
    end

    classDef frontend fill:#BBDEFB,stroke:#333,stroke-width:1px
    classDef gateway fill:#C8E6C9,stroke:#333,stroke-width:1px
    classDef micro fill:#FFF9C4,stroke:#333,stroke-width:1px
    classDef infra fill:#FFCC80,stroke:#333,stroke-width:1px
    classDef db fill:#E0E0E0,stroke:#333,stroke-width:1px
```
