# menztel/nextframe architecture

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

- Interactive diagram: https://gitdiagram.com/menztel/nextframe
- Repository: https://github.com/menztel/nextframe

## Overview

##### Project Overview & Purpose
- This project is a Content Management Framework (CMF) that enables users to create and manage "vitrine" (display) websites.
- It is built with PHP 8 following the MVC (Model-View-Controller) design pattern, making it a full-stack web application with a strong focus on customizable templating and front-end assets (using SASS, GrapesJS, Amchart).

##### Key Components
a. Frontend:
- The public-facing layer is defined under the "public" directory (with an entry point index.php) and includes assets (CSS, JavaScript, images, SVGs).
- The "app/Views" directory is subdivided into front-office templates and pages, defining how content is rendered to users.
- "resources" includes JavaScript, SASS files, and a webpack configuration for building the front-end assets.

b. Backend:
- The "app" directory is the heart of the CMF:
- "Controllers" handles HTTP requests for various pages: home, dashboard, articles, users, security, etc.
- "Models" contains the business logic and data handling classes for interacting with articles, categories, comments, settings, and users.
- "Views" also includes a back-office section for administrative tasks, installer pages and partials.
- "config" and "core" directories include configuration files, routing settings (routes.yml), database connection (DB.php), and backup functionality.
- The custom templating engine is integrated in the views while the MVC pattern separates concerns within the app.

c. Infrastructure & Deployment:
- Docker:
- The project containerizes its environment using a docker-compose file along with dedicated configurations stored in the "docker" directory (nginx and PHP Dockerfiles, nginx.conf).
- These files indicate that Nginx acts as the web server/reverse proxy and PHP executes the application code.
- Build Tools:
- Composer is used to manage PHP dependencies (executed in the "app" directory).
- Node.js (npm) is used to manage front-end build processes (in the "resources" directory).

d. Database:
- The project includes an SQL script in "app/db/script.sql", indicating initial database schema creation.
- Although not explicitly seen as a running service in the file tree, the database component is implied as it supports the CMS functionality.

##### Important Architectural Patterns / Design Principles
- MVC Pattern: Clearly separate Controllers (managing request logic), Models (data and business logic), and Views (presentation).
- Templating and Custom Engine: Highlight that there is a bespoke templating system to render dynamic pages in both front-office and back-office contexts.
- Containerization: Emphasize the use of Docker, where Nginx and PHP services are containerized.
- Asset Build Pipeline: Note the role of Webpack, npm, and the SASS-based component system to deliver a responsive front-end.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("Client Browser"):::external

    subgraph "Infrastructure"
        B("Nginx Container"):::infrastructure
        C("PHP Container"):::infrastructure
        X("Database Container"):::infrastructure
        N("Docker Setup"):::infrastructure
    end

    subgraph "Presentation Layer"
        D("Public/index.php"):::frontend
        E("Public/assets"):::frontend
        F("Front Office Views"):::frontend
        G("Back Office Views"):::frontend
    end

    subgraph "Business Logic Layer"
        J("Configuration & Routing"):::backend
        H("Controllers"):::backend
        I("Models"):::backend
        K("Core Functionality"):::backend
        O("Composer Dependencies"):::build
    end

    subgraph "Data Layer"
        L("Database (SQL)"):::external
    end

    subgraph "Build Pipeline"
        M("Frontend Build Resources"):::build
    end

    A --> B
    B --> C
    C --> D
    D --> J
    J --> H
    H --> I
    I --> K
    K --> L
    I --> L
    H --> F
    H --> G
    M --> E
    N --> B
    N --> C
    N --> X
    O --> H

    click D "https://github.com/menztel/nextframe/blob/dev/public/index.php"
    click E "https://github.com/menztel/nextframe/tree/dev/public/assets"
    click F "https://github.com/menztel/nextframe/tree/dev/app/Views/front-office"
    click G "https://github.com/menztel/nextframe/tree/dev/app/Views/back-office"
    click H "https://github.com/menztel/nextframe/tree/dev/app/Controllers"
    click I "https://github.com/menztel/nextframe/tree/dev/app/Models"
    click J "https://github.com/menztel/nextframe/tree/dev/app/config"
    click K "https://github.com/menztel/nextframe/tree/dev/app/core"
    click L "https://github.com/menztel/nextframe/blob/dev/app/db/script.sql"
    click M "https://github.com/menztel/nextframe/tree/dev/resources"
    click N "https://github.com/menztel/nextframe/tree/dev/docker"
    click O "https://github.com/menztel/nextframe/blob/dev/app/composer.json"

    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef frontend fill:#cce5ff,stroke:#0056b3,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef infrastructure fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef build fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
