# mdhedayet/laravel-vue-spa-skeleton architecture

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

- Interactive diagram: https://gitdiagram.com/mdhedayet/laravel-vue-spa-skeleton
- Repository: https://github.com/mdhedayet/laravel-vue-spa-skeleton

## Overview

##### Main Components

A. Frontend Layer:
- Vue.js SPA Application
- Core Components (resources/js/core)
- Modular Structure (resources/js/modules)
- State Management (Vuex stores)
- Routing System (Vue Router)
- UI Components (ElementUI)
- i18n Internationalization

B. Backend Layer:
- Laravel API Application
- Modular Structure (app/Modules)
- Authentication System (JWT + Sanctum)
- Database Layer
- Command System (for module generation)

**┌─────────────────────────────────────────────────────────┐**
- Client Browser                         │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Frontend (Vue.js SPA)                                   │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐        │
- Core       │ │  Modules    │ │  Shared     │        │
- Components  │ │ (Auth,      │ │ (Store,     │        │
- (App.vue)   │ │  Settings,  │ │  Router)    │        │
- ┘ │  Dashboard) │ └─────────────┘        │
- ┘                        │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Backend (Laravel API)                                   │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐        │
- API Routes │ │  Modules    │ │  Services   │        │
- & Middle-  │ │ Controllers │ │  & Repos    │        │
- ware     │ │ & Resources │ │             │        │
- ┘ └─────────────┘ └─────────────┘        │
- ┘
- ↕
**┌─────────────────────────────────────────────────────────┐**
- Database                            │
- ┘

##### Special Attention Points

A. Module System:
- How modules are dynamically loaded
- Module generation system
- Symmetry between frontend and backend modules

B. Authentication Flow:
- JWT token handling
- Sanctum integration
- Authentication middleware

C. State Management:
- Vuex store structure
- Module-specific stores
- Global state management

##### Additional Elements

- Notes about the module generation command
- I18n system integration
- ElementUI component usage
- API routing structure

##### Implementation Details

- The modular architecture allowing independent module development
- The CRUD generation capability
- The separation between frontend and backend concerns
- The scalability of the architecture
- The security implementation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph Frontend["Frontend Layer"]
        VueSPA["Vue.js SPA"]
        CoreComponents["Core Components"]:::frontend
        Modules["Frontend Modules"]:::frontend
        Store["State Management (Vuex)"]:::frontend
        Router["Routing System"]:::frontend
        i18n["i18n System"]:::frontend
        ElementUI["ElementUI Components"]:::frontend
        
        subgraph FrontendModules["Module Components"]
            AuthModule["Auth Module"]:::frontend
            DashboardModule["Dashboard Module"]:::frontend
            SettingsModule["Settings Module"]:::frontend
            NotificationModule["Notification Module"]:::frontend
        end
    end

    subgraph Backend["Backend Layer"]
        LaravelAPI["Laravel API"]
        APIRoutes["API Routes"]:::backend
        APIMiddleware["Middleware"]:::backend
        
        subgraph BackendModules["API Modules"]
            AuthController["Auth Controllers"]:::backend
            SettingsController["Settings Controller"]:::backend
            ModuleCommand["Module Generator"]:::backend
        end
        
        Repository["Repository Layer"]:::backend
    end

    subgraph Database["Database Layer"]
        DB[(Database)]:::database
        Migrations["Migrations"]:::database
    end

    %% Relationships
    Browser --> VueSPA
    VueSPA --> CoreComponents
    VueSPA --> Modules
    VueSPA --> Store
    VueSPA --> Router
    VueSPA --> i18n
    VueSPA --> ElementUI
    
    Modules --> FrontendModules
    
    VueSPA --> LaravelAPI
    LaravelAPI --> APIRoutes
    LaravelAPI --> APIMiddleware
    LaravelAPI --> BackendModules
    BackendModules --> Repository
    Repository --> DB
    DB --> Migrations

    %% Click Events
    click CoreComponents "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/core"
    click Modules "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/modules"
    click Store "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/core/store"
    click Router "https://github.com/mdhedayet/laravel-vue-spa-skeleton/blob/master/resources/js/bootstrap/router.js"
    click i18n "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/includes/lang"
    click BackendModules "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/app/Modules"
    click AuthController "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/app/Modules/Auth"
    click Migrations "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/database/migrations"
    click ModuleCommand "https://github.com/mdhedayet/laravel-vue-spa-skeleton/blob/master/app/Console/Commands/MakeModuleCommand.php"
    click AuthModule "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/modules/auth"
    click AuthController "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/app/Modules/Auth/Controllers"
    click DashboardModule "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/modules/dashboard"
    click SettingsController "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/app/Modules/Setting"
    click SettingsModule "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/modules/setting"
    click NotificationModule "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/resources/js/modules/notification"
    click APIRoutes "https://github.com/mdhedayet/laravel-vue-spa-skeleton/blob/master/routes/api.php"
    click Repository "https://github.com/mdhedayet/laravel-vue-spa-skeleton/tree/master/app/Repositories"
    click APIMiddleware "https://github.com/mdhedayet/laravel-vue-spa-skeleton/blob/master/app/Http/Middleware/Authenticate.php"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DatabaseComp["Database Component"]:::database
        Security["Security Component"]:::security
    end
```
