# mustafacagri/mevn-boilerplate architecture

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

- Interactive diagram: https://gitdiagram.com/mustafacagri/mevn-boilerplate
- Repository: https://github.com/mustafacagri/mevn-boilerplate

## Overview

##### Project Type and Purpose
- This is a MEVN stack boilerplate intended for rapid development of admin dashboards and client applications.
- It comprises three major parts: the admin dashboard (designed for management and internal operations), the client (built using Nuxt 3 for public user-facing features), and the server (ExpressJS/Node backend connected to MongoDB).
- The README also mentions external integrations like TipTap (for rich text editing), Vuetify (for Material Design Vue components), and authentication mechanisms.

##### Main Components
- Admin Frontend:
– Located in the “admin” folder.
– Built with Vue 3 and Vuetify/Vuexy-style components.
– Contains separate modules for layouts, pages, components, and custom SCSS for theming.
- Client Frontend:
– Located in the “client” folder.
– A Nuxt 3 based application with pages, layouts, plugins, and stores.
– Features for user authentication, support tickets, posts, and other public-facing functions.
- Server/Backend:
– Found in the “server” folder.
– An ExpressJS application that defines controllers, routes, models, middleware, and utility classes for handling requests, authentication, error handling, and mail sending.
– Connects to MongoDB (as specified in the .env configuration) to store and retrieve data.
- Database:
– MongoDB is used for persistent storage.
- External Services and Environment:
– Environment configuration (.env files) suggests integration with mailing services (NodeMailer) for notifications.
– Various endpoints for API interactions; these are consumed by both admin and client applications as defined in their respective environment configuration.

##### Relationships and Interactions
- Both the Admin and the Client applications interact with the Server’s RESTful API.
– Highlight that the server uses controllers (such as those for authentication, posts, tickets, etc.) to process these requests and then responds.
- The Server communicates with:
– MongoDB (via its models and configuration in the “server/models” directory).
– External services (e.g., mailing services via NodeMailer).
- For UI, show that the Admin and Client applications have their own component hierarchies, with clear areas for layout, state management (Vuex/Pinia in admin and Nuxt store in client), and plugin usage.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
– Frontend code is separated into two distinct projects (admin and client) with clear boundaries.
– The backend is cleanly separated into controllers, routes, models, middleware, and utility functions.
- Modularization:
– Both client and admin have modular directories for components (e.g., for posts, users, utilities) and assets (styles, images).
– The server similarly organizes its resources into folders for business logic, making it scalable and maintainable.
- Layered Architecture:
– Frontend (presentation layer), Backend (business logic layer), and Database (data access layer).

- You might want to include annotations such as the configuration values defined in the .env files (e.g., API endpoint URLs) to further clarify component interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% High-level Components
    A["Admin Dashboard (Vue3/Vuetify)"]:::admin
    B["Client App (Nuxt3)"]:::client
    C["API Server (Express/Node)"]:::server
    D["MongoDB"]:::db

    %% High-level Interactions
    A -->|"API_calls"| C
    B -->|"API_calls"| C
    C -->|"Data_read/write"| D

    %% Admin Frontend Details
    subgraph "Admin Details"
        direction TB
        A1["Pages"]
        A2["Components"]
        A3["Layouts"]
        A4["Assets"]
        A2 -->|"includes"| T["TipTap Integration"]
        A2 ---|"uses"| V["Vuetify Integration"]
    end
    A --- A1
    A --- A2
    A --- A3
    A --- A4

    %% Client Frontend Details
    subgraph "Client Details"
        direction TB
        C1["Pages"]
        C2["Components"]
        C3["Layouts"]
        C4["Assets"]
    end
    B --- C1
    B --- C2
    B --- C3
    B --- C4

    %% Server/Backend Details
    subgraph "Server Components"
        direction TB
        S1["Controllers"]
        S2["Routes"]
        S3["Middlewares"]
        S4["Models"]
        S5["Utilities"]
        S3 -->|"includes"| S6["Auth/Authorization"]
        S5 -->|"handles"| S7["Email/Notification Service"]
    end
    C --- S1
    C --- S2
    C --- S3
    C --- S4
    C --- S5

    %% Click Events
    click A "https://github.com/mustafacagri/mevn-boilerplate/tree/main/admin/"
    click B "https://github.com/mustafacagri/mevn-boilerplate/tree/main/client/"
    click C "https://github.com/mustafacagri/mevn-boilerplate/tree/main/server/"
    click D "https://github.com/mustafacagri/mevn-boilerplate/blob/main/server/config/db.js"
    click T "https://github.com/mustafacagri/mevn-boilerplate/blob/main/admin/src/components/utils/TipTap.vue"
    click V "https://github.com/mustafacagri/mevn-boilerplate/tree/main/admin/src/plugins/vuetify/"
    click S7 "https://github.com/mustafacagri/mevn-boilerplate/blob/main/server/utils/sendMail.js"
    click S6 "https://github.com/mustafacagri/mevn-boilerplate/tree/main/server/middlewares/user/"

    %% Styles
    classDef admin fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef client fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef server fill:#ccccff,stroke:#333,stroke-width:2px;
    classDef db fill:#ffffcc,stroke:#333,stroke-width:2px;
```
