# matt-clegg/mcc-next architecture

> Architecture diagram of the GitHub repository matt-clegg/mcc-next, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/matt-clegg/mcc-next
- Repository: https://github.com/matt-clegg/mcc-next

## Overview

##### Main Components

Frontend Layer:
- Client-side Components (/app/components)
- Admin Section
- Events Management
- Page Management
- Asset Management
- UI Components
- Pages and Routing (/app/pages)
- Layouts (/app/layouts)
- Composables (/app/composables)

Backend Layer:
- Server API Routes (/server/api)
- Database Layer (/server/database)
- Authentication & Authorization
- File/Asset Management
- Email System

Database Schema Components:
- User Management Tables
- Event Management Tables
- Content Management Tables
- Asset Management Tables
- Role-based Access Control Tables

**┌─────────────────────────────────────────────────────────┐**
- Client Layer                         │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐    │
- Pages    │  │  Components │  │  Composables │    │
- ┘  └─────────────┘  └─────────────┘    │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- API Layer                            │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐    │
- Auth APIs  │  │ Event APIs  │  │ Asset APIs  │    │
- ┘  └─────────────┘  └─────────────┘    │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Database Layer                         │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐    │
- Users/Roles│  │   Events    │  │   Assets    │    │
- ┘  └─────────────┘  └─────────────┘    │
- ┘

##### Key Relationships to Highlight

- User Authentication Flow
- Role-based Access Control
- Event Management Workflow
- Asset Management Pipeline
- Page Content Management

##### Technical Stack Indicators

- Nuxt.js Framework
- Vue.js Components
- Database (likely SQL based on Drizzle config)
- Authentication System
- File Storage System

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white
    classDef utility fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        Pages["Pages"]:::frontend
        AdminPages["Admin Pages"]:::frontend
        Layouts["Layouts"]:::frontend
        
        subgraph Components
            AdminComp["Admin Components"]:::frontend
            EventComp["Event Components"]:::frontend
            PageComp["Page Components"]:::frontend
            AssetComp["Asset Components"]:::frontend
            UIComp["UI Components"]:::frontend
        end
        
        subgraph FrontendLogic
            Composables["Composables"]:::frontend
            Middleware["Middleware"]:::frontend
        end
    end

    %% API Layer
    subgraph APILayer
        AuthAPI["Auth API"]:::api
        UserAPI["User API"]:::api
        EventAPI["Event API"]:::api
        AssetAPI["Asset API"]:::api
        RoleAPI["Role API"]:::api
    end

    %% Database Layer
    subgraph Database
        UserDB[(User Tables)]:::database
        EventDB[(Event Tables)]:::database
        AssetDB[(Asset Tables)]:::database
        RoleDB[(Role Tables)]:::database
        PageDB[(Page Tables)]:::database
        EmailDB[(Email Tables)]:::database
    end

    %% Authorization System
    subgraph Auth
        RoleDef["Role Definitions"]:::auth
        AuthPlugin["Authorization Plugin"]:::auth
        SessionMgmt["Session Management"]:::auth
    end

    %% Utilities
    subgraph Utilities
        FileHandler["File Handler"]:::utility
        EmailSystem["Email System"]:::utility
        DBUtils["Database Utils"]:::utility
        SharedUtils["Shared Utils"]:::utility
    end

    %% Relationships
    Frontend --> APILayer
    APILayer --> Database
    APILayer --> Auth
    Auth --> Database
    APILayer --> Utilities
    Utilities --> Database

    %% Click Events
    click AdminComp "https://github.com/matt-clegg/mcc-next/tree/master/app/components/admin/"
    click EventComp "https://github.com/matt-clegg/mcc-next/tree/master/app/components/events/"
    click PageComp "https://github.com/matt-clegg/mcc-next/tree/master/app/components/page/"
    click AssetComp "https://github.com/matt-clegg/mcc-next/tree/master/app/components/asset/"
    click UIComp "https://github.com/matt-clegg/mcc-next/tree/master/app/components/ui/"
    click Pages "https://github.com/matt-clegg/mcc-next/tree/master/app/pages/"
    click AdminPages "https://github.com/matt-clegg/mcc-next/tree/master/app/pages/admin/"
    click Layouts "https://github.com/matt-clegg/mcc-next/tree/master/app/layouts/"
    click Composables "https://github.com/matt-clegg/mcc-next/tree/master/app/composables/"
    click Middleware "https://github.com/matt-clegg/mcc-next/tree/master/app/middleware/"
    click AuthAPI "https://github.com/matt-clegg/mcc-next/tree/master/server/api/auth/"
    click UserAPI "https://github.com/matt-clegg/mcc-next/tree/master/server/api/users/"
    click EventAPI "https://github.com/matt-clegg/mcc-next/tree/master/server/api/events/"
    click AssetAPI "https://github.com/matt-clegg/mcc-next/tree/master/server/api/assets/"
    click RoleAPI "https://github.com/matt-clegg/mcc-next/tree/master/server/api/roles/"
    click UserDB "https://github.com/matt-clegg/mcc-next/blob/master/server/database/schema/users.ts"
    click EventDB "https://github.com/matt-clegg/mcc-next/tree/master/server/database/schema/events/"
    click AssetDB "https://github.com/matt-clegg/mcc-next/blob/master/server/database/schema/assets.ts"
    click RoleDB "https://github.com/matt-clegg/mcc-next/blob/master/server/database/schema/roles.ts"
    click PageDB "https://github.com/matt-clegg/mcc-next/blob/master/server/database/schema/pages.ts"
    click EmailDB "https://github.com/matt-clegg/mcc-next/blob/master/server/database/schema/email.ts"
    click RoleDef "https://github.com/matt-clegg/mcc-next/tree/master/shared/utils/abilities/"
    click AuthPlugin "https://github.com/matt-clegg/mcc-next/blob/master/server/plugins/authorization-resolver.ts"
    click SessionMgmt "https://github.com/matt-clegg/mcc-next/blob/master/server/plugins/session.ts"
    click FileHandler "https://github.com/matt-clegg/mcc-next/blob/master/server/utils/assets.ts"
    click EmailSystem "https://github.com/matt-clegg/mcc-next/blob/master/server/utils/mail.ts"
    click DBUtils "https://github.com/matt-clegg/mcc-next/blob/master/server/utils/database.ts"
    click SharedUtils "https://github.com/matt-clegg/mcc-next/tree/master/shared/utils/"
```
