# leacarp/rappi-tp architecture

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

- Interactive diagram: https://gitdiagram.com/leacarp/rappi-tp
- Repository: https://github.com/leacarp/rappi-tp

## Overview

##### Project type and purpose
- This is an Nx‐managed monorepo containing:
- A NestJS backend application (`apps/rappi-backend-m2`)
- An end-to-end test suite for that backend (`apps/rappi-backend-m2-e2e`)
- Purpose: to serve as a modular, testable backend API built with NestJS and orchestrated via Nx.

##### File structure
- Top level: standard Nx workspace files (`nx.json`, `tsconfig.base.json`, CI workflow, package.json)
- apps/
- `rappi-backend-m2/` – the NestJS application
– `src/main.ts`: entry point, bootstraps Nest application
– `src/app/app.module.ts`: root module, imports submodules, declares controllers & providers
– `src/app/app.controller.ts` & `app.service.ts`: sample controller/service pair
– `webpack.config.js`: custom build config
- `rappi-backend-m2-e2e/` – Jest-based e2e tests
– `src/support/` for setup/teardown scripts
– `rappi-backend-m2.spec.ts`: example end-to-end test against the running backend
- Config files: per-project `project.json`, ESLint, tsconfig, Jest configs

##### README for additional insights
- Confirms Nx + NestJS stack
- Shows how to serve, build, and test via `npx nx` commands
- Mentions the ability to generate new apps/libs using Nx plugins

a. Main components
– Nx Workspace (container for all projects and shared code)
– rappi-backend-m2 (NestJS HTTP API server)
– rappi-backend-m2-e2e (test runner invoking HTTP calls)
– External dependencies (e.g., Database, Cache, Third‐party APIs – if/when added)
– CI Pipeline (GitHub Actions workflow)
b. Relationships and interactions
– CI → Nx Workspace: triggers build/test tasks
– Nx Workspace → rappi-backend-m2: runs `serve` and `build`
– rappi-backend-m2-e2e → rappi-backend-m2: HTTP requests to exposed endpoints
c. Architectural patterns and design principles
– NestJS modular structure (AppModule imports, controllers/providers)
– MVC: Controllers handle routes → Services contain business logic
– Nx project graph: independent tasks and dependency orchestration
– e2e testing layer separated from production code
d. Key technologies/frameworks
– Node.js + TypeScript
– NestJS (Modules, Controllers, Services)
– Nx (monorepo tooling, generators, task runner)
– Jest (unit & e2e testing)
– Webpack (custom build pipeline)

##### Elements
- Workspace → API (build/serve)
- API → Database (read/write)
- e2e → API (HTTP requests)
- CI → Workspace (triggers tasks)
- Runtime components (API, Database) in another
- Test harness in a third

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestration Layer
    CI["CI/CD (GitHub Actions)"]:::orchestration
    Nx["Nx Workspace"]:::orchestration

    %% Runtime Layer
    subgraph "rappi-backend-m2 (NestJS API)"
        direction TB
        API_Main["main.ts"]:::runtime
        API_Module["app.module.ts"]:::runtime
        API_Controller["app.controller.ts"]:::runtime
        API_Service["app.service.ts"]:::runtime
    end
    DB["Database (e.g. PostgreSQL)"]:::runtime

    %% Test Layer
    E2E["rappi-backend-m2-e2e (Jest E2E)"]:::test

    %% Relationships
    CI -->|"triggers"| Nx
    Nx -->|"build / serve"| API_Main
    API_Main -->|"imports"| API_Module
    API_Module -->|"declares"| API_Controller
    API_Module -->|"provides"| API_Service
    API_Main -->|"runtime"| DB
    E2E -->|"HTTP requests"| API_Main

    %% Click Events
    click Nx "https://github.com/leacarp/rappi-tp/blob/master/nx.json"
    click CI "https://github.com/leacarp/rappi-tp/blob/master/.github/workflows/ci.yml"
    click API_Main "https://github.com/leacarp/rappi-tp/blob/master/apps/rappi-backend-m2/src/main.ts"
    click API_Module "https://github.com/leacarp/rappi-tp/blob/master/apps/rappi-backend-m2/src/app/app.module.ts"
    click API_Controller "https://github.com/leacarp/rappi-tp/blob/master/apps/rappi-backend-m2/src/app/app.controller.ts"
    click API_Service "https://github.com/leacarp/rappi-tp/blob/master/apps/rappi-backend-m2/src/app/app.service.ts"
    click E2E "https://github.com/leacarp/rappi-tp/blob/master/apps/rappi-backend-m2-e2e/src/rappi-backend-m2/rappi-backend-m2.spec.ts"

    %% Styles
    classDef orchestration fill:#D6EAF8,stroke:#1F618D,color:#1B4F72;
    classDef runtime fill:#D5F5E3,stroke:#196F3D,color:#145A32;
    classDef test fill:#FADBD8,stroke:#943126,color:#641E16;
```
