# thanhbui27/homepage-cms architecture

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

- Interactive diagram: https://gitdiagram.com/thanhbui27/homepage-cms
- Repository: https://github.com/thanhbui27/homepage-cms

## Overview

The project is a Strapi-based headless CMS. Its purpose is to provide a customizable content management system with an admin interface and a range of API endpoints to serve data, making it ideal for building backend systems that manage various content types (such as blogs, categories, job listings, etc.). The file structure shows standard Strapi conventions, with directories for configuration (config), the API content types (src/api), the dedicated administration panel (src/admin), and even custom components and extensions. Additionally, the presence of Docker-related files and deployment scripts (Dockerfile, docker-compose.yml, deploy.sh) indicates that the project is intended to be containerized and deployed using modern DevOps practices.

##### Main Components
a. Admin Panel – Represented by the contents in src/admin. This is the web-based UI that administrators use to manage the content.
b. API Endpoints – These are spread across multiple folders under src/api (e.g., blog, blog-category, category, feedback, home-page, job-category, job-position, level, location, product, recruitment, ways-of-working). Each API usually contains:
- Content types (schema definitions)
- Controllers (request handling logic)
- Routes (mapping URLs to controllers)
- Services (business logic layer)
- Documentation (versioned API docs)
c. Database – Even though the specific database isn’t defined in detail, there is a database directory with migrations. Indicate that the Strapi project connects to a database (MySQL, PostgreSQL, MongoDB, etc.).
d. Configuration & Middleware – Found in config (including server, plugins, middlewares, database, etc.), these files dictate how Strapi is bootstrapped and how the request lifecycle is managed.
e. Extensions & Helper Components – Custom extensions (in src/extensions) and helper functions (in src/helper) are used to enhance the core functionality.
f. Deployment & Containerization – Use of Dockerfile, docker-compose.yml, and deploy.sh should be noted as part of the infrastructure and deployment strategy.

##### Relationships and Interactions
- The Admin Panel interacts with the API layer to render the administrative UI and manage content.
- API endpoints expose CRUD operations for each content type. They include separate controllers, services, and routes for handling requests.
- The API layer communicates with the database to persist data.
- The configuration layer affects both the Admin and API parts by setting up the server environment, middleware, and plugins.
- Extensions are plugged into the central Strapi app to augment core functionalities.

##### Architectural Patterns and Design Principles
- Modular Design: Each API (or content type) is encapsulated in its own module (with content-types, controllers, routes, services, etc.), following a typical MVC-like separation.
- Configuration-over-Code: Centralized configuration files allow easy management of environment-specific options.
- Containerization: The project utilizes Docker to ensure consistency across development, testing, and production environments.
- Documentation and Versioning: Each API’s documentation is versioned (e.g., “1.0.0”) to ensure clarity and maintainability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Deployment Environment
    DE("Deployment & Containerization"):::deployment

    %% Strapi Application Cluster
    subgraph "Strapi Application"
        CFG["General Configuration & Middleware"]:::config
        ADMIN["Admin Panel"]:::admin
        API["API Endpoints"]:::api
        EXT["Extensions"]:::extension
        HELP["Helper Components"]:::helper
    end

    %% API Modules Cluster
    subgraph "API Modules"
        BLOG["Blog API"]:::apiModule
        BLOGCAT["Blog-Category API"]:::apiModule
        CAT["Category API"]:::apiModule
        FB["Feedback API"]:::apiModule
        HP["Home-Page API"]:::apiModule
        JC["Job-Category API"]:::apiModule
        JP["Job-Position API"]:::apiModule
        LV["Level API"]:::apiModule
        LOC["Location API"]:::apiModule
        PROD["Product API"]:::apiModule
        REC["Recruitment API"]:::apiModule
        WOF["Ways-of-Working API"]:::apiModule
    end

    %% Database Node
    DB("Database (Persistent Storage)"):::database

    %% Relationships
    DE --> CFG
    CFG --> ADMIN
    CFG --> API
    ADMIN --> API
    API --> BLOG
    API --> BLOGCAT
    API --> CAT
    API --> FB
    API --> HP
    API --> JC
    API --> JP
    API --> LV
    API --> LOC
    API --> PROD
    API --> REC
    API --> WOF
    BLOG --> DB
    BLOGCAT --> DB
    CAT --> DB
    FB --> DB
    HP --> DB
    JC --> DB
    JP --> DB
    LV --> DB
    LOC --> DB
    PROD --> DB
    REC --> DB
    WOF --> DB
    EXT --> API
    HELP --> API

    %% Click Events
    click ADMIN "https://github.com/thanhbui27/homepage-cms/tree/main/src/admin"
    click API "https://github.com/thanhbui27/homepage-cms/tree/main/src/api"
    click BLOG "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/blog"
    click BLOGCAT "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/blog-category"
    click CAT "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/category"
    click FB "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/feedback"
    click HP "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/home-page"
    click JC "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/job-category"
    click JP "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/job-position"
    click LV "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/level"
    click LOC "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/location"
    click PROD "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/product"
    click REC "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/recruitment"
    click WOF "https://github.com/thanhbui27/homepage-cms/tree/main/src/api/ways-of-working"
    click CFG "https://github.com/thanhbui27/homepage-cms/tree/main/config"
    click EXT "https://github.com/thanhbui27/homepage-cms/tree/main/src/extensions"
    click HELP "https://github.com/thanhbui27/homepage-cms/tree/main/src/helper"
    click DB "https://github.com/thanhbui27/homepage-cms/blob/main/config/database.js"
    click DE "https://github.com/thanhbui27/homepage-cms/tree/main/Dockerfile"

    %% Styles
    classDef admin fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef config fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef api fill:#D5F5E3,stroke:#196F3D,stroke-width:2px;
    classDef apiModule fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef database fill:#F5CBA7,stroke:#7D6608,stroke-width:2px;
    classDef deployment fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef extension fill:#FADBD8,stroke:#922B21,stroke-width:2px;
    classDef helper fill:#FCF3CF,stroke:#7D6608,stroke-width:2px;
```
