# nntan2002/sventure architecture

> Architecture diagram of the GitHub repository nntan2002/sventure, 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/nntan2002/sventure
- Repository: https://github.com/nntan2002/sventure

## Overview

##### Main components
- Frontend Client: Represented by the Nuxt/Vue application. This component handles UI rendering, user interactions, and communicates with the backend APIs.
- Backend CMS: Built on Strapi, this contains the API endpoints. Note the multiple API modules (e.g., building, category-service, contact, header, page-home, etc.) that follow typical MVC patterns (with controllers, routes, and services).
- Database: While not separately visible as a dedicated “database” folder, the CMS/config/database.js and migrations components hint at a persistent storage layer (whether it's PostgreSQL, MongoDB, etc.) that supports the Strapi CMS.
- External Services/Configurations: There are configuration files for deployment (ecosystem.config.js on both frontend and backend), environment files (.env), and files for proper code styling and linting. These indicate integration with CI/CD pipelines and other deployment tools.

##### Important architectural patterns/principles
- MVC Pattern in Strapi CMS: As seen in the cms/src/api/* directories, each API follows a pattern with content types, controllers, routes, and services.
- Separation of Concerns: The clear division between frontend (presentation/UI layer) and backend (data layer and API logic).
- Modular organization: Each API endpoint (for building, contact, header, etc.) is separated into self-contained modules.
- Environment-based configuration: With files like .env.example and various config files, the deployment setup is designed to easily switch contexts.

##### Relevant technologies and frameworks
- Frontend: Nuxt.js and Vue.js, along with Bootstrap for styling.
- Backend: Strapi as the headless CMS, using Node.js and likely employing various npm packages listed in package.json.
- Additional tools: ESLint, EditorConfig, and ecosystem configuration for process management.

- Clear labels for each major component: “Frontend (Nuxt/Vue)” and “Backend (Strapi CMS)” with further sub-labels to denote API modules if desired.
- A distinct “Database” component showing persistent storage.
- Annotations or brief descriptions on critical connections such as “API calls,” “data retrieval,” or “configuration management (CI/CD).”

## Diagram (Mermaid)

```mermaid
flowchart TB

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend (Nuxt/Vue)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE["Backend (Strapi CMS)"]:::backend
        API["API Modules (Controllers,Routes,Services)"]:::backendModule
        BE -->|"contains"| API
    end

    %% Main Data Flow
    FE -->|"APIcalls"| BE

    %% Database Layer
    subgraph "Database Layer"
        DB1["Database Config"]:::database
        DB2["Database Migrations"]:::database
    end

    BE -->|"dataPersistence"| DB1
    BE -->|"dataPersistence"| DB2

    %% Deployment & Configuration
    subgraph "Deployment & Config Tools"
        FE_D["Frontend Deployment (ecosystem)"]:::deploy
        BE_D["Backend Deployment (ecosystem)"]:::deploy
        ENV["Environment Config (.envexample)"]:::deploy
        LINT["Linting &EditorConfig"]:::deploy
    end

    %% Deployment connections (dashed lines)
    FE_D --- FE
    BE_D --- BE
    ENV --- FE
    ENV --- BE
    LINT --- FE

    %% Click Events
    click FE "https://github.com/nntan2002/sventure/tree/main/frontend"
    click BE "https://github.com/nntan2002/sventure/tree/main/cms"
    click API "https://github.com/nntan2002/sventure/tree/main/cms/src/api"
    click DB1 "https://github.com/nntan2002/sventure/blob/main/cms/config/database.js"
    click DB2 "https://github.com/nntan2002/sventure/tree/main/cms/database/migrations"
    click FE_D "https://github.com/nntan2002/sventure/blob/main/frontend/ecosystem.config.js"
    click BE_D "https://github.com/nntan2002/sventure/blob/main/cms/ecosystem.config.js"
    click ENV "https://github.com/nntan2002/sventure/blob/main/cms/.env.example"

    %% Styling
    classDef frontend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef backendModule fill:#98fb98,stroke:#000,stroke-width:2px;
    classDef database fill:#d3d3d3,stroke:#000,stroke-width:2px,stroke-dasharray: 5,5;
    classDef deploy fill:#f0e68c,stroke:#000,stroke-width:2px;
```
