# aphiendaidai/doan2 architecture

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

- Interactive diagram: https://gitdiagram.com/aphiendaidai/doan2
- Repository: https://github.com/aphiendaidai/doan2

## Overview

##### Main Components
- Frontend/UI Layer: Represented by the Blade views in the resources/views directory (with subdirectories for admin, company, and front) and assets (CSS, JS, images). This layer defines the user interface and presentation.
- Application Layer: This includes the core business logic that resides mainly in the controllers (found under app/Http/Controllers with subdivisions for admin, company, etc.) as well as middleware (app/Http/Middleware) which handles request filtering and authentication/authorization.
- Domain/Model Layer: The models in app/Models encapsulate your data structures (such as User, Job, Category, etc.) and use Laravel’s Eloquent ORM for database interactions.
- Database Layer: Illustrated by the migrations in the database/migrations and seeders in database/seeders – they define schema evolution and populate initial data.
- Infrastructure Layer: This includes configuration files (config/), the bootstrap process (bootstrap/), and external services (such as email services used in app/Mail and external integrations that could be mentioned in config/services.php).
- Public/Asset Layer: The public directory holds client-accessible static resources and the entry point (public/index.php) that acts as the gateway to your application.

- From public to the Laravel application layer, show how the request flows through routing (routes/web.php) into controllers.
- Middleware as a side component attached to the HTTP flow to indicate pre-processing and filtering of requests.
- Database with a separate component connected to the Model layer, noting migrations and ORM interactions.
- A component for external services if applicable (for things like email notifications, third-party APIs, or real-time event mechanisms).

##### Architectural Patterns and Design Principles
- MVC structure since the controllers, views, and models are clearly segmented.
- Dependency Injection and Service Provider patterns – for example, note the AppServiceProvider and other providers that register services.
- Laravel’s routing and middleware system as key aspects of request handling.
- Separation between the presentation (Blade-based views) and the business logic (controllers and models).

##### Including Technologies, Frameworks, and Libraries
- That Laravel is the core framework.
- That Eloquent ORM is used for database operations.
- Mention Laravel’s built-in routing, caching, and queue systems (configured via files in config/).
- Front-end tooling (e.g., Vite as per vite.config.js, Tailwind CSS as per tailwind.config.js, and additional libraries included via package.json).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client("Browser"):::client

    %% Public/Asset Layer
    PublicEntry("Entry Point (public/index.php)"):::entry

    %% Routing and Application Layer
    subgraph "Routing & Application Layer"
        Routing("Routing (routes/web.php)"):::routing
        Middleware("Middleware (app/Http/Middleware)"):::middleware
        Controllers("Controllers (app/Http/Controllers)"):::controllers
    end

    %% Domain/Model Layer
    subgraph "Domain Layer"
        Models("Models (Eloquent - app/Models)"):::models
    end

    %% Database Layer
    subgraph "Database Layer"
        Migrations("Migrations (database/migrations)"):::database
        Seeders("Seeders (database/seeders)"):::database
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        Config("Configuration (config/)"):::infrastructure
        Bootstrap("Bootstrap (bootstrap/)"):::infrastructure
        Providers("Service Providers (app/Providers)"):::infrastructure
        Mail("Mail Services (app/Mail)"):::infrastructure
    end

    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        BladeViews("Blade Views (resources/views)"):::frontend
        Assets("Assets (public/assets, resources/css, resources/js)"):::frontend
    end

    %% Connections for Request Flow
    Client -->|"request"| PublicEntry
    PublicEntry -->|"routes"| Routing
    Routing -->|"preprocess"| Middleware
    Middleware -->|"invokes"| Controllers
    Controllers -->|"renders view"| BladeViews
    BladeViews -->|"delivers UI"| Client

    %% Additional Application interactions
    Controllers -->|"data access"| Models
    Models -->|"DB ops"| Migrations
    Models -->|"DB ops"| Seeders
    Controllers -->|"uses"| Config
    Controllers -->|"initializes via"| Bootstrap
    Controllers -->|"injects via"| Providers
    Controllers -->|"sends"| Mail

    %% Click Events
    click BladeViews "https://github.com/aphiendaidai/doan2/tree/master/resources/views"
    click Assets "https://github.com/aphiendaidai/doan2/tree/master/public/assets"
    click Controllers "https://github.com/aphiendaidai/doan2/tree/master/app/Http/Controllers"
    click Middleware "https://github.com/aphiendaidai/doan2/tree/master/app/Http/Middleware"
    click Models "https://github.com/aphiendaidai/doan2/tree/master/app/Models"
    click Migrations "https://github.com/aphiendaidai/doan2/tree/master/database/migrations"
    click Seeders "https://github.com/aphiendaidai/doan2/tree/master/database/seeders"
    click Config "https://github.com/aphiendaidai/doan2/tree/master/config/"
    click Bootstrap "https://github.com/aphiendaidai/doan2/tree/master/bootstrap/"
    click Providers "https://github.com/aphiendaidai/doan2/tree/master/app/Providers"
    click Mail "https://github.com/aphiendaidai/doan2/tree/master/app/Mail"
    click PublicEntry "https://github.com/aphiendaidai/doan2/tree/master/public"

    %% Styles
    classDef client fill:#f9e79f,stroke:#000,stroke-width:2px;
    classDef entry fill:#aed6f1,stroke:#000,stroke-width:2px;
    classDef routing fill:#abebc6,stroke:#000,stroke-width:2px;
    classDef middleware fill:#f5b7b1,stroke:#000,stroke-width:2px;
    classDef controllers fill:#d2b4de,stroke:#000,stroke-width:2px;
    classDef models fill:#f9c79f,stroke:#000,stroke-width:2px;
    classDef database fill:#82e0aa,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#f7dc6f,stroke:#000,stroke-width:2px;
    classDef frontend fill:#85c1e9,stroke:#000,stroke-width:2px;
```
