# pos-cmd/clevercms architecture

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

- Interactive diagram: https://gitdiagram.com/pos-cmd/clevercms
- Repository: https://github.com/pos-cmd/clevercms

## Overview

##### Main Components

A. Frontend Layer:
- Admin Panel (Vue.js Application)
- Components structure (/admin/src/components)
- Views structure (/admin/src/views)
- State management (Pinia stores)
- Internationalization system
- Theme system

B. Backend Layer:
- Web Application (AdonisJS Framework)
- API Controllers
- Authentication system
- Content Management modules
- Database models
- Middleware layer

C. Database Layer:
- Content Management tables
- User management tables
- Authorization tables
- SEO and metadata tables

D. Shared Libraries:
- Axios wrapper
- Hooks
- Materials
- Utils

##### Component Relationships

- Admin Panel → Backend API (REST/HTTP)
- Backend → Database (ORM layer)
- Shared Libraries ↔ Both Frontend and Backend
- Authentication flow between components
- Content management flow

##### Architectural Patterns to Highlight

- MVC Pattern in the backend
- Component-based architecture in the frontend
- Module-based organization
- Middleware pipeline
- Service layer pattern

**┌─────────────────────────────────────────────────────────────┐**
- Admin Panel (Vue.js)                     │
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌────────┐ │
- Views  │ │  Store  │ │  i18n   │ │ Themes  │ │ Router │ │
- ┘ └─────────┘ └─────────┘ └─────────┘ └────────┘ │
- ┬───────────────────────────────┘

**┌─────────────────────────────▼───────────────────────────────┐**
- Shared Libraries Layer                    │
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────────────┐│
- Axios  │ │ Hooks   │ │ Utils   │ │ UI Materials        ││
- ┘ └─────────┘ └─────────┘ └─────────────────────┘│
- ┬───────────────────────────────┘

**┌─────────────────────────────▼───────────────────────────────┐**
- Backend (AdonisJS)                        │
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐           │
- Auth   │ │   API   │ │Services │ │  ACL    │           │
- ┘ └─────────┘ └─────────┘ └─────────┘           │
- ┌─────────────────────┐ ┌───────────────────────┐         │
- Content Management  │ │ User Management        │         │
- ┘ └───────────────────────┘         │
- ┬───────────────────────────────┘

**┌─────────────────────────────▼───────────────────────────────┐**
- Database                             │
- ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐           │
- Users  │ │ Content │ │  SEO    │ │ Blocks  │           │
- ┘ └─────────┘ └─────────┘ └─────────┘           │
- ┘

##### Additional Elements

- Authentication flow
- Relationship between blocks, sections, and pages
- Internationalization system
- Theme system architecture

##### Important Notes

- Keep the focus on the content management aspects
- Clear separation between admin and public interfaces
- Modular nature of the system
- Role-based access control system
- Relationship between different content types (pages, blocks, sections)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Admin[Admin Panel - Vue.js]
        direction TB
        Components["Components"]:::frontend
        Views["Views"]:::frontend
        Store["State Management"]:::frontend
        i18n["i18n System"]:::frontend
        Theme["Theme System"]:::frontend
        Router["Route Management"]:::frontend
        FormBuilder["Form Builder"]:::frontend
        Layout["Layout System"]:::frontend
    end

    subgraph Shared["Shared Libraries Layer"]
        direction TB
        Axios["Axios Wrapper"]:::shared
        Hooks["Hooks"]:::shared
        Utils["Utils"]:::shared
        Materials["UI Materials"]:::shared
        Color["Color Utilities"]:::shared
    end

    subgraph Backend["Backend - AdonisJS"]
        direction TB
        Auth["Authentication System"]:::backend
        API["API Controllers"]:::backend
        ContentMgmt["Content Management"]:::backend
        Models["Database Models"]:::backend
        Middleware["Middleware Layer"]:::backend
    end

    subgraph DB["Database Layer"]
        direction TB
        Users["User Tables"]:::database
        Content["Content Tables"]:::database
        SEO["SEO Tables"]:::database
        Auth_Tables["Authorization Tables"]:::database
    end

    %% Connections
    Admin --> Shared
    Shared --> Backend
    Backend --> DB

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:#fff
    classDef shared fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef backend fill:#e67e22,stroke:#d35400,color:#fff
    classDef database fill:#9b59b6,stroke:#8e44ad,color:#fff

    %% Click Events
    click Components "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/components/"
    click Views "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/views/"
    click Store "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/stores/"
    click i18n "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/locales/"
    click Theme "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/theme/"
    click Router "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/router/"
    click FormBuilder "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/components/FormBuilder/"
    click Layout "https://github.com/Pos-cmd/CleverCMS/tree/main/admin/src/layouts/"

    click Axios "https://github.com/Pos-cmd/CleverCMS/tree/main/lib/axios/"
    click Hooks "https://github.com/Pos-cmd/CleverCMS/tree/main/lib/hooks/"
    click Utils "https://github.com/Pos-cmd/CleverCMS/tree/main/lib/utils/"
    click Materials "https://github.com/Pos-cmd/CleverCMS/tree/main/lib/materials/"
    click Color "https://github.com/Pos-cmd/CleverCMS/tree/main/lib/color/"

    click API "https://github.com/Pos-cmd/CleverCMS/tree/main/web/app/controllers/"
    click Auth "https://github.com/Pos-cmd/CleverCMS/blob/main/web/app/controllers/auth_controller.ts"
    click ContentMgmt "https://github.com/Pos-cmd/CleverCMS/tree/main/web/app/controllers/content_management/"
    click Models "https://github.com/Pos-cmd/CleverCMS/tree/main/web/app/models/"
    click Middleware "https://github.com/Pos-cmd/CleverCMS/tree/main/web/app/middleware/"

    click Users "https://github.com/Pos-cmd/CleverCMS/blob/main/web/database/migrations/1735827945393_create_users_table.ts"
    click Auth_Tables "https://github.com/Pos-cmd/CleverCMS/blob/main/web/database/migrations/1735834517334_create_role_permissions_table.ts"
    click SEO "https://github.com/Pos-cmd/CleverCMS/blob/main/web/database/migrations/ContentManagement/1735896670394_create_seo_metas_table.ts"
    click Content "https://github.com/Pos-cmd/CleverCMS/tree/main/web/database/migrations/ContentManagement/"
```
