# rahulp1273/recipe-hub architecture

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

- Interactive diagram: https://gitdiagram.com/rahulp1273/recipe-hub
- Repository: https://github.com/rahulp1273/recipe-hub

## Overview

##### Project type and purpose
- RecipeHub is a full-stack, monolithic recipe-sharing platform:
- Backend: Laravel 10 (PHP) with MVC (models, controllers, migrations)
- Frontend: Vue.js 3 + Vite, bundled into a “dist” directory for production
- Mobile shell: Capacitor (Android folder)
- Database: MySQL, managed via Laravel’s Eloquent ORM and migrations
- Auth: Laravel Sanctum (API token + session cookies)

##### File structure
- Top-level folders:
- app/ — Laravel MVC code (Controllers, Models, Requests, Providers)
- bootstrap/, config/ — framework bootstrap & configuration
- database/ — migrations & seeders for MySQL schema
- resources/js/ — Vue components, pages, router, global CSS/axios/bootstrap
- public/ & dist/ — web server entrypoints (public/index.php, dist/index.html + assets)
- android/ — Capacitor Android project for mobile deployment
- storage/ — file upload storage (public & private)
- routes/ — API and web routes definitions
- tests/ — Feature/Unit tests
- Build scripts & tools:
- composer.json for PHP dependencies
- package.json, vite.config.js, tailwind.config.js for frontend build
- .env.example for environment variables (DB, API keys, etc.)

##### Key architecture notes from README
- Single backend monolith exposing both web routes (Blade welcome page) and a JSON API under api.php
- Frontend is a SPA that communicates via Axios to `/api/*` endpoints secured by Sanctum
- Capacitor packages the same web build for mobile

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    WebClient["Web Browser (Vue SPA)"]:::client
    StaticSPA["Web Client Production Build\ndist/"]:::client
    BuildConfig["Frontend Build Configs\n(package.json,\nvite.config.js,\ntailwind.config.js,\npostcss.config.js)"]:::client
    MobileClient["Mobile App (Capacitor WebView)"]:::client

    %% Gateway
    APIgateway["API Gateway / Web Server\n(public/index.php)"]:::gateway
    StaticEntrypoint["Static SPA Entrypoint\ndist/index.html,\ndist/index.php"]:::gateway

    %% Monolith
    subgraph "Laravel Monolith"
        subgraph "Routing"
            ApiRoutes["API Routes\nroutes/api.php"]:::module
            WebRoutes["Web Routes\nroutes/web.php,\nroutes/auth.php"]:::module
        end
        subgraph "HTTP Layer"
            Controllers["Controllers\napp/Http/Controllers/"]:::module
            ApiControllers["API Controllers\napp/Http/Controllers/Api/"]:::module
            AuthController["AuthController\napp/Http/Controllers/AuthController.php"]:::module
        end
        subgraph "Request & Validation"
            Requests["Requests\napp/Http/Requests/"]:::module
        end
        subgraph "Business Logic"
            AiController["AiRecipeController\napp/Http/Controllers/Api/AiRecipeController.php"]:::module
            Services["Services"]:::module
        end
        subgraph "Data Layer"
            Models["Eloquent Models\napp/Models/"]:::module
            Migrations["Migrations\ndatabase/migrations/"]:::module
            Seeders["Seeders & Factories\ndatabase/seeders/,\ndatabase/factories/"]:::module
        end
        subgraph "Storage Module"
            FileStorage["File Storage\nstorage/app/public/"]:::module
        end
        subgraph "Queue/Jobs Module"
            Queue["Queue Workers"]:::module
        end
        subgraph "Configuration & Bootstrap"
            AppProvider["AppServiceProvider\napp/Providers/AppServiceProvider.php"]:::module
            BootstrapApp["Bootstrap App\nbootstrap/app.php"]:::module
            Env["Env Template\n.env.example"]:::module
            DBConfig["Database Config\nconfig/database.php"]:::module
            SanctumConfig["Sanctum Config\nconfig/sanctum.php"]:::module
            FilesystemConfig["Filesystems Config\nconfig/filesystems.php"]:::module
            QueueConfig["Queue Config\nconfig/queue.php"]:::module
        end
    end

    %% Datastore & External
    DB["MySQL Database"]:::database
    StorageExt["External Storage (S3/local)"]:::storage
    AIService["External AI Service"]:::external
    EmailService["Email Provider"]:::external

    %% Flows
    WebClient -->|HTTPS| APIgateway
    MobileClient -->|HTTPS| APIgateway
    StaticSPA -->|served| StaticEntrypoint
    StaticEntrypoint --> APIgateway
    APIgateway -->|routes| ApiRoutes
    APIgateway -->|routes| WebRoutes
    ApiRoutes --> ApiControllers
    WebRoutes --> Controllers
    Controllers -->|validate| Requests
    ApiControllers -->|validate| Requests
    Controllers --> Services
    ApiControllers --> Services
    Services --> Models
    Services --> FileStorage
    Services --> AIService
    AIService -->|response| Services
    Controllers --> Queue
    Queue --> Models
    Queue --> FileStorage
    Models --> DB
    FileStorage --> StorageExt

    %% Click Events
    click WebClient "https://github.com/rahulp1273/recipe-hub/tree/main/resources/js/"
    click StaticSPA "https://github.com/rahulp1273/recipe-hub/tree/main/dist/"
    click BuildConfig "https://github.com/rahulp1273/recipe-hub/blob/main/package.json"
    click BuildConfig "https://github.com/rahulp1273/recipe-hub/blob/main/vite.config.js"
    click BuildConfig "https://github.com/rahulp1273/recipe-hub/blob/main/tailwind.config.js"
    click BuildConfig "https://github.com/rahulp1273/recipe-hub/blob/main/postcss.config.js"
    click MobileClient "https://github.com/rahulp1273/recipe-hub/tree/main/android/"
    click APIgateway "https://github.com/rahulp1273/recipe-hub/blob/main/public/index.php"
    click StaticEntrypoint "https://github.com/rahulp1273/recipe-hub/blob/main/dist/index.html"
    click StaticEntrypoint "https://github.com/rahulp1273/recipe-hub/blob/main/dist/index.php"
    click Controllers "https://github.com/rahulp1273/recipe-hub/tree/main/app/Http/Controllers/"
    click ApiControllers "https://github.com/rahulp1273/recipe-hub/tree/main/app/Http/Controllers/Api/"
    click AuthController "https://github.com/rahulp1273/recipe-hub/blob/main/app/Http/Controllers/AuthController.php"
    click Requests "https://github.com/rahulp1273/recipe-hub/tree/main/app/Http/Requests/"
    click AiController "https://github.com/rahulp1273/recipe-hub/blob/main/app/Http/Controllers/Api/AiRecipeController.php"
    click Models "https://github.com/rahulp1273/recipe-hub/tree/main/app/Models/"
    click Migrations "https://github.com/rahulp1273/recipe-hub/tree/main/database/migrations/"
    click Seeders "https://github.com/rahulp1273/recipe-hub/blob/main/database/seeders/DatabaseSeeder.php"
    click Seeders "https://github.com/rahulp1273/recipe-hub/tree/main/database/factories/"
    click ApiRoutes "https://github.com/rahulp1273/recipe-hub/blob/main/routes/api.php"
    click WebRoutes "https://github.com/rahulp1273/recipe-hub/blob/main/routes/web.php"
    click WebRoutes "https://github.com/rahulp1273/recipe-hub/blob/main/routes/auth.php"
    click AppProvider "https://github.com/rahulp1273/recipe-hub/blob/main/app/Providers/AppServiceProvider.php"
    click BootstrapApp "https://github.com/rahulp1273/recipe-hub/blob/main/bootstrap/app.php"
    click Env "https://github.com/rahulp1273/recipe-hub/blob/main/.env.example"
    click DBConfig "https://github.com/rahulp1273/recipe-hub/blob/main/config/database.php"
    click SanctumConfig "https://github.com/rahulp1273/recipe-hub/blob/main/config/sanctum.php"
    click FilesystemConfig "https://github.com/rahulp1273/recipe-hub/blob/main/config/filesystems.php"
    click QueueConfig "https://github.com/rahulp1273/recipe-hub/blob/main/config/queue.php"

    %% Styles
    classDef client fill:#E0F7FA,stroke:#00796B
    classDef gateway fill:#FFF3E0,stroke:#FB8C00
    classDef module fill:#E8F5E9,stroke:#388E3C
    classDef database fill:#FFF8E1,stroke:#FBC02D
    classDef storage fill:#E3F2FD,stroke:#1976D2
    classDef external fill:#F3E5F5,stroke:#8E24AA
```
