# elan47/mcr architecture

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

- Interactive diagram: https://gitdiagram.com/elan47/mcr
- Repository: https://github.com/elan47/mcr

## Overview

##### Project type and purpose
- This is a Strapi-based headless CMS project.
- It provides:
- A REST/JSON API for multiple content types (aptus, campaign-product, etc.)
- A built-in admin panel (React/Vite) for content management
- File and media storage under public/uploads
- Configurable via config/*.ts and extendable via src/extensions

##### File structure and architectural patterns
- Top-level:
- config/ – global settings (database, server, plugins, middlewares)
- database/ – migrations folder
- public/ – static assets (robots.txt, uploads)
- src/admin/ – admin UI source (React + Vite)
- src/api/… – each content type as a self-contained module (schema, controllers, routes, services)
- src/extensions/… – plugin customizations (documentation, users-permissions)
- index.ts – Strapi bootstrap entry point
- Pattern: Modular MVC for each content type, plus plugin architecture for extensions

##### README insights
- Standard Strapi commands to run, build and deploy
- Strapi CLI scaffolds the project and loads modules from src/api and src/extensions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External clients and frontend
    subgraph "External Clients"
        Clients["External Clients\n(Mobile Apps, 3rd-party)"]:::external
    end
    subgraph "Frontend"
        AdminUI["Admin UI\n(React/Vite)"]:::frontend
    end

    Clients -->|HTTP/REST, GraphQL| API["Strapi API Server\n(Node.js/Koa)"]:::api
    AdminUI -->|HTTP/REST, GraphQL| API

    %% Core initialization
    API -->|"bootstrap"| Bootstrap["Strapi Bootstrap\n(index.ts)"]:::api
    Bootstrap -->|"load config"| Config["Global Config\n(config/*)"]:::api
    Bootstrap -->|"init plugins"| PluginsLayer["Plugin/Extension Layer"]:::plugin

    %% Plugins/Extensions
    subgraph "Plugins/Extensions"
        Documentation["Documentation Plugin"]:::plugin
        UsersPermissions["Users & Permissions Plugin"]:::plugin
    end
    PluginsLayer --> Documentation
    PluginsLayer --> UsersPermissions

    %% Routing and MVC pipeline
    Bootstrap -->|"initialize router"| Router["Router (routes)"]:::api
    Router --> Controllers["Controllers"]:::api
    Controllers --> Services["Services"]:::api
    Services --> ORM["ORM/Models"]:::api

    %% API Modules
    subgraph "API Modules" 
        aptus["aptus"]:::apiModule
        campaignProduct["campaign-product"]:::apiModule
        campaignType["campaign-type"]:::apiModule
        city["city"]:::apiModule
        client["client"]:::apiModule
        equita["equita"]:::apiModule
        socialType["social-type"]:::apiModule
        state["state"]:::apiModule
        table["table"]:::apiModule
        ujjivan["ujjivan"]:::apiModule
        version["version"]:::apiModule
        workType["work-type"]:::apiModule
        year["year"]:::apiModule
    end
    Router --> aptus & campaignProduct & campaignType & city & client & equita & socialType & state & table & ujjivan & version & workType & year
    aptus & campaignProduct & campaignType & city & client & equita & socialType & state & table & ujjivan & version & workType & year --> Controllers

    %% Storage
    ORM --> Database["Database\n(SQL/NoSQL)"]:::storage
    Services --> FileStore["File Store\n(public/uploads)"]:::storage

    %% Supporting artifacts
    subgraph "Supporting Artifacts"
        Migrations["Migrations Folder\n(database/migrations/)"]:::storage
        Components["Shared Schemas\n(src/components/)"]:::api
        Types["Generated TS Definitions\n(types/generated/)"]:::api
        Public["Public Files\n(public/)"]:::storage
    end
    Bootstrap --> Migrations
    Bootstrap --> Components
    Bootstrap --> Types
    Public --> FileStore

    %% Click Events
    click AdminUI "https://github.com/elan47/mcr/tree/main/src/admin/"
    click Bootstrap "https://github.com/elan47/mcr/blob/main/index.ts"
    click Config "https://github.com/elan47/mcr/tree/main/config/"
    click Migrations "https://github.com/elan47/mcr/tree/main/database/migrations/"
    click FileStore "https://github.com/elan47/mcr/tree/main/public/uploads/"
    click aptus "https://github.com/elan47/mcr/tree/main/src/api/aptus/"
    click campaignProduct "https://github.com/elan47/mcr/tree/main/src/api/campaign-product/"
    click campaignType "https://github.com/elan47/mcr/tree/main/src/api/campaign-type/"
    click city "https://github.com/elan47/mcr/tree/main/src/api/city/"
    click client "https://github.com/elan47/mcr/tree/main/src/api/client/"
    click equita "https://github.com/elan47/mcr/tree/main/src/api/equita/"
    click socialType "https://github.com/elan47/mcr/tree/main/src/api/social-type/"
    click state "https://github.com/elan47/mcr/tree/main/src/api/state/"
    click table "https://github.com/elan47/mcr/tree/main/src/api/table/"
    click ujjivan "https://github.com/elan47/mcr/tree/main/src/api/ujjivan/"
    click version "https://github.com/elan47/mcr/tree/main/src/api/version/"
    click workType "https://github.com/elan47/mcr/tree/main/src/api/work-type/"
    click year "https://github.com/elan47/mcr/tree/main/src/api/year/"
    click Components "https://github.com/elan47/mcr/tree/main/src/components/"
    click Documentation "https://github.com/elan47/mcr/tree/main/src/extensions/documentation/"
    click UsersPermissions "https://github.com/elan47/mcr/tree/main/src/extensions/users-permissions/"
    click Types "https://github.com/elan47/mcr/tree/main/types/generated/"
    click Public "https://github.com/elan47/mcr/tree/main/public/"

    %% Styles
    classDef frontend fill:#BBE1FA,stroke:#333,stroke-width:1px
    classDef api fill:#C8E6C9,stroke:#333,stroke-width:1px
    classDef apiModule fill:#A5D6A7,stroke:#333,stroke-width:1px
    classDef storage fill:#FFECB3,stroke:#333,stroke-width:1px
    classDef plugin fill:#E1BEE7,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
```
