# chikashishirozu/my-kakeibo-laravel05 architecture

> Architecture diagram of the GitHub repository chikashishirozu/my-kakeibo-laravel05, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chikashishirozu/my-kakeibo-laravel05
- Repository: https://github.com/chikashishirozu/my-kakeibo-laravel05

## Overview

##### Project type and purpose
- This is a full-stack Laravel web application (“my-kakeibo-laravel05”) for household accounting (tracking expenses, budget goals, daily records, monthly summaries, user profiles, dashboards).
- It uses MVC on the backend (PHP/Laravel), Blade for server-side rendered views, SQLite locally, and typical Laravel services (auth, queue, mail, filesystem, etc.).

##### File structure
- Top-level:
- app/Http/Controllers → HTTP controllers (Auth, BudgetGoalsController, DailyRecordsController, DashboardsController)
- app/Models → Eloquent models (User, BudgetGoal, DailyRecord, Dashboard, MonthlySummary)
- app/Http/Middleware → request filters (RedirectIfAuthenticated)
- database/migrations & seeders → schema definition and initial data
- resources/views → Blade templates organized by feature (auth, budget_goals, daily_records, dashboard, profile, layouts, components)
- routes/web.php & routes/api.php → route definitions
- public/index.php → front controller
- config/*.php → service and environment config
- Patterns: classic MVC, RESTful resource controllers, Blade component system, standard Laravel middleware pipeline.

##### README
- Confirms purpose (household accounting), tech stack (Laravel, PHP, SQLite), installation steps (composer, PHP extensions, SQLite setup).
- Mentions migrations, seeding, resource controllers, Blade views, environment switching (SQLite local vs MySQL/PostgreSQL in prod), and dev tools (npm, Vite).

a. Main components to show:
- Client (Browser or API consumer)
- Web Server Entry Point (public/index.php + nginx/apache)
- Laravel Kernel & Middleware Pipeline
- Router (routes/web.php, routes/api.php)
- Controllers (Auth, BudgetGoals, DailyRecords, Dashboards, Profile)
- Service Layer (Eloquent ORM via Models)
- Database (SQLite file, migrations)
- Blade View Engine & Static Assets (CSS/JS via Vite/bundler)
- External Services (Mail, Queue, Cache, Filesystems as configured)

b. Relationships & data flows:
- Static assets loaded directly from public/css and public/js via Vite dev server or build pipeline.
- API endpoints (routes/api.php) bypass Blade, return JSON.

c. Architectural patterns & design principles:
- MVC Separation: Controllers handle HTTP, Models handle data, Views handle rendering.
- RESTful Resource Controllers (CRUD for budgets, records).
- Middleware for auth/guest redirection.
- Configuration driven via .env and config/*.php for environment portability.
- Blade Components for UI reuse & consistency.

d. Key technologies & libraries:
- Laravel framework (HTTP kernel, routing, middleware, service container)
- Eloquent ORM (Models, Migrations, Seeders)
- Blade templating & Blade Components
- SQLite (local DB)
- Laravel Auth scaffolding
- Vite + npm (assets bundling)
- PHPUnit (testing)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    subgraph "Client Layer"
        Client["Browser/API Client"]:::external
    end

    subgraph "Web Server Layer"
        WebServer["Web Server\nnginx/apache\npublic/index.php"]:::backend
    end

    subgraph "Application Layer"
        KernelMiddleware["Laravel Kernel\nMiddleware Pipeline"]:::middleware
        RouterWeb["Web Router\nroutes/web.php"]:::backend
        RouterAPI["API Router\nroutes/api.php"]:::backend

        subgraph "Controllers"
            LoginController["LoginController"]:::controller
            RegisterController["RegisterController"]:::controller
            BudgetGoalsController["BudgetGoalsController"]:::controller
            DailyRecordsController["DailyRecordsController"]:::controller
            DashboardsController["DashboardsController"]:::controller
            ProfileViews["Profile Views"]:::assets
        end

        subgraph "Models"
            UserModel["User Model"]:::model
            BudgetGoalModel["BudgetGoal Model"]:::model
            DailyRecordModel["DailyRecord Model"]:::model
            DashboardModel["Dashboard Model"]:::model
            MonthlySummaryModel["MonthlySummary Model"]:::model
        end

        subgraph "Blade Views & Components"
            AuthViews["Auth Views"]:::assets
            BudgetViews["Budget Views"]:::assets
            DailyViews["Daily Views"]:::assets
            DashboardViews["Dashboard Views"]:::assets
            ProfileViews
            Layouts["Layouts"]:::assets
            Components["Blade Components"]:::assets
        end
    end

    subgraph "Static Asset Pipeline"
        ViteConfig["Vite Config\nvite.config.js"]:::external
        CSS_src["resources/css/app.css"]:::assets
        JS_src["resources/js/app.js"]:::assets
        BootstrapJS["resources/js/bootstrap.js"]:::assets
        CompiledCSS["public/css/app.css"]:::assets
    end

    subgraph "Data Layer"
        SQLiteDB["SQLite DB\ndatabase/database.sqlite"]:::db
        Migrations["Migrations\ndatabase/migrations/*.php"]:::db
        Seeders["Seeders\ndatabase/seeders/DatabaseSeeder.php"]:::db
    end

    subgraph "Configuration"
        ConfigDB["database.php"]:::external
        ConfigAuth["auth.php"]:::external
        ConfigQueue["queue.php"]:::external
        ConfigMail["mail.php"]:::external
        ConfigServices["services.php"]:::external
        ConfigCache["cache.php"]:::external
        ConfigSession["session.php"]:::external
    end

    subgraph "External Services"
        MailService["Mail Service"]:::external
        QueueService["Queue Service"]:::external
        CacheService["Cache Service"]:::external
        FSService["Filesystem"]:::external
    end

    subgraph "Tests"
        FeatureTests["Feature Tests"]:::external
        UnitTests["Unit Tests"]:::external
    end

    %% Flows
    Client -->|"HTTP Request"| WebServer
    WebServer -->|"index.php"| KernelMiddleware
    KernelMiddleware --> RouterWeb
    KernelMiddleware --> RouterAPI

    RouterWeb --> LoginController
    RouterWeb --> RegisterController
    RouterWeb --> BudgetGoalsController
    RouterWeb --> DailyRecordsController
    RouterWeb --> DashboardsController
    RouterWeb --> AuthViews
    RouterWeb --> BudgetViews
    RouterWeb --> DailyViews
    RouterWeb --> DashboardViews
    RouterWeb --> ProfileViews

    RouterAPI --> DailyRecordsController
    RouterAPI --> BudgetGoalsController

    LoginController --> UserModel
    RegisterController --> UserModel
    BudgetGoalsController --> BudgetGoalModel
    DailyRecordsController --> DailyRecordModel
    DashboardsController --> DashboardModel

    BudgetGoalsController --> QueueService
    DailyRecordsController --> MailService
    DashboardsController --> MailService

    Controllers --> BladeViews & Components

    UserModel --> SQLiteDB
    BudgetGoalModel --> SQLiteDB
    DailyRecordModel --> SQLiteDB
    DashboardModel --> SQLiteDB
    MonthlySummaryModel --> SQLiteDB

    Migrations --> SQLiteDB
    Seeders --> SQLiteDB

    Client -->|"Request CSS/JS"| CompiledCSS
    ViteConfig --> CSS_src
    ViteConfig --> JS_src
    ViteConfig --> BootstrapJS
    CSS_src --> CompiledCSS
    JS_src --> CompiledCSS
    BootstrapJS --> CompiledCSS
    CompiledCSS --> Client

    ConfigDB --> KernelMiddleware
    ConfigAuth --> KernelMiddleware
    ConfigQueue --> QueueService
    ConfigMail --> MailService
    ConfigServices --> MailService
    ConfigCache --> CacheService
    ConfigSession --> KernelMiddleware

    %% Click Events
    click WebServer "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/public/index.php"
    click KernelMiddleware "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Middleware/RedirectIfAuthenticated.php"
    click RouterWeb "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/routes/web.php"
    click RouterAPI "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/routes/api.php"
    click LoginController "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Controllers/Auth/LoginController.php"
    click RegisterController "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Controllers/Auth/RegisterController.php"
    click BudgetGoalsController "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Controllers/BudgetGoalsController.php"
    click DailyRecordsController "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Controllers/DailyRecordsController.php"
    click DashboardsController "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Http/Controllers/DashboardsController.php"
    click UserModel "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Models/User.php"
    click BudgetGoalModel "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Models/BudgetGoal.php"
    click DailyRecordModel "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Models/DailyRecord.php"
    click DashboardModel "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Models/Dashboard.php"
    click MonthlySummaryModel "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/app/Models/MonthlySummary.php"
    click SQLiteDB "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/database/database.sqlite"
    click Migrations "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/database/migrations/*.php"
    click Seeders "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/database/seeders/DatabaseSeeder.php"
    click AuthViews "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/auth"
    click BudgetViews "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/budget_goals"
    click DailyViews "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/daily_records"
    click DashboardViews "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/dashboard"
    click ProfileViews "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/profile"
    click Layouts "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/layouts"
    click Components "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/resources/views/components"
    click ViteConfig "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/vite.config.js"

    click ConfigDB "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/database.php"
    click ConfigAuth "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/auth.php"
    click ConfigQueue "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/queue.php"
    click ConfigMail "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/mail.php"
    click ConfigServices "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/services.php"
    click ConfigCache "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/cache.php"
    click ConfigSession "https://github.com/chikashishirozu/my-kakeibo-laravel05/blob/main/config/session.php"
    click FeatureTests "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/tests/Feature"
    click UnitTests "https://github.com/chikashishirozu/my-kakeibo-laravel05/tree/main/tests/Unit"

    %% Styles
    classDef external fill:#f2f2f2,stroke:#999,stroke-width:1px
    classDef backend fill:#e8f0fe,stroke:#3b78ff,stroke-width:1px
    classDef middleware fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px
    classDef controller fill:#fff3e0,stroke:#fb8c00,stroke-width:1px
    classDef model fill:#e0f2f1,stroke:#00796b,stroke-width:1px
    classDef db fill:#e8f5e9,stroke:#43a047,stroke-width:1px
    classDef assets fill:#fff8e1,stroke:#f9a825,stroke-width:1px
```
