# ndbaolam/flavorfood architecture

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

- Interactive diagram: https://gitdiagram.com/ndbaolam/flavorfood
- Repository: https://github.com/ndbaolam/flavorfood

## Overview

##### Main Components
- Frontend Application:
- Located under apps/frontend.
- Built using modern web technologies (React, Vite, Tailwind CSS, etc.) with a clear separation of views (pages) and UI components (components, layouts, and routes).
- Backend/API Services:
- Found under apps/services.
- A NestJS-based application organized in multiple feature modules (auth, categories, recipes, favorite, review, tips, upload, users, etc.).
- Uses modules to leverage Nest’s modular and layered architecture for clean separation of concerns.
- End-to-End (E2E) Testing:
- Present under apps/services-e2e.
- Contains tests for the services, confirming that API endpoints and integrations work as expected.
- External Dependencies:
- PostgreSQL is run via Docker Compose (as indicated by the provided instructions) which serves as the database.
- Other external resources, like Cloudinary (for uploads), are integrated through a provider in the upload module.

##### File Structure for Architectural Patterns
- Monorepo Managed with Nx:
- The workspace is organized into multiple projects (apps and libs, though this project mainly shows apps) with separate project configurations (e.g., project.json files and Nx targets).
- Frontend Layers:
- Organized with pages, layouts, components, and services – clearly following a component-based UI architectural pattern.
- Backend Layers:
- Uses NestJS, with modules that encapsulate controllers, services, DTOs, and entities.
- This modular decomposition implies a clean separation of concerns with well-defined APIs between modules.
- Build and Deployment Infrastructure:
- Docker, Docker Compose, and configuration files (Dockerfile, docker-compose.yaml) show containerized deployment.
- Yarn and Nx are used to run, build, and test tasks.

##### Relationships and Interactions
- That E2E tests simulate Frontend-to-Backend workflows.
- Use labels to show data flow (e.g., API request/response, authentication flows, file uploads, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Application"
        FE["Frontend Application"]:::frontend
        FE_UI["UI Components"]:::frontend
        FE_ROUTE["Routing"]:::frontend
        FE_ASSETS["Static Assets"]:::frontend
        FE --> FE_UI
        FE --> FE_ROUTE
        FE --> FE_ASSETS
    end

    subgraph "Backend (NestJS Services)"
        BE["Backend (NestJS Services)"]:::backend
        subgraph "Modules"
            BE1["Auth Module"]:::backend
            BE2["Categories Module"]:::backend
            BE3["Recipes Module"]:::backend
            BE4["Favorite Module"]:::backend
            BE5["Review Module"]:::backend
            BE6["Tips Module"]:::backend
            BE7["Upload Module"]:::backend
            BE8["Users Module"]:::backend
        end
        BE --> BE1
        BE --> BE2
        BE --> BE3
        BE --> BE4
        BE --> BE5
        BE --> BE6
        BE --> BE7
        BE --> BE8
    end

    DB["PostgreSQL Database"]:::db
    TEST["Services E2E Tests"]:::testing
    INF["Project Tools: Nx, Yarn, DockerCompose"]:::infra
    CLOUD["Cloudinary Provider"]:::integration

    FE -->|"API_Calls"| BE
    BE -->|"DB_Queries"| DB
    TEST -->|"Test_API"| BE
    BE7 -->|"Upload_to_Cloudinary"| CLOUD

    %% Click Events
    click FE "https://github.com/ndbaolam/flavorfood/tree/main/apps/frontend"
    click BE "https://github.com/ndbaolam/flavorfood/tree/main/apps/services"
    click TEST "https://github.com/ndbaolam/flavorfood/tree/main/apps/services-e2e"
    click DB "https://github.com/ndbaolam/flavorfood/blob/main/docker-compose.yaml"

    %% Styles
    classDef frontend fill:#CDE6F5,stroke:#2E6EA8,stroke-width:2px,color:#000;
    classDef backend fill:#F5ECCE,stroke:#B8860B,stroke-width:2px,color:#000;
    classDef db fill:#FADBD8,stroke:#C0392B,stroke-width:2px,color:#000;
    classDef testing fill:#d5f5e3,stroke:#27ae60,stroke-width:2px,color:#000;
    classDef infra fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px,color:#000;
    classDef integration fill:#D6EAF8,stroke:#3498DB,stroke-width:2px,color:#000;
```
