# xyzjonas/chef architecture

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

- Interactive diagram: https://gitdiagram.com/xyzjonas/chef
- Repository: https://github.com/xyzjonas/chef

## Overview

##### Project type and purpose
- This is a full-stack recipe management application (“Chef”) with:
- A Vue.js single-page application (SPA) frontend under `src/js/chef`
- A FastAPI + SQLAlchemy backend under `src/python/chef`
- A relational database (PostgreSQL or SQLite) via SQLAlchemy & Alembic migrations
- Optional containerized deployment (Docker, GCP Cloud Run)
- Optional Google Cloud Storage integration for images via `gcsfuse`

##### File structure
Top-level
- Dockerfile / gcp.Dockerfile / entrypoint.sh / install.sh — containerization & startup
- alembic.ini & `src/python/migrations` — database migrations
- `pyproject.toml` — Python dependencies & entry points (CLI commands: `chef`, `chef migrate-db`)
- `scripts/` — utility scripts for data/image migration
Frontend (`src/js/chef`)
- Standard Vue 3 + Quasar CLI structure: `public/`, `src/` (components, views, router, stores, composables)
- Build config: `vite.config.ts`, `uno.config.ts`
Backend (`src/python/chef`)
- `main.py` — FastAPI app instantiation
- `api/*.py` — route definitions (categories, recipes, ingredients, tags, images)
- `controllers.py` — business-logic layer
- `models.py` + `schemas.py` — ORM models & Pydantic schemas
- `session.py` / `settings.py` — DB sessions & configuration
- `image/` — storage abstraction & thumbnailer
- `scripts/` — backend-specific migration scripts
Tests (`tests/python/*`)
- Coverage for controllers, models, routes, images

##### README for additional insights
- Confirms core tech stack: FastAPI, SQLAlchemy, Alembic, VueJS
- Usage patterns: single binary/package, Docker, GCP
- Migrations invoked via CLI or directly with Alembic
- Cloud Storage parameters (`BUCKET`, `MNT_DIR`, `IMAGES_FOLDER`)

##### Elements
– Labels: component names (e.g., “VueJS SPA”, “FastAPI API”, “Postgres DB”, “GCS Bucket”)
– Notes or annotations for key paths (e.g., “Image upload flow”, “Schema migrations via Alembic”)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    User["User (Browser)"]:::external
    VueJSApp["VueJS SPA"]:::frontend
    User -->|"interacts with"| VueJSApp

    %% Frontend Layer
    subgraph "Frontend Layer"
        VueJSApp
        ViteConfig["vite.config.ts"]:::frontend
        UnoConfig["uno.config.ts"]:::frontend
        Router["Router (index.ts)"]:::frontend
        Stores["Stores"]:::frontend
        APIComposable["API Composable (api.ts)"]:::frontend
    end

    %% API Boundary
    VueJSApp -->|"HTTP(S) REST"| FastAPI

    %% Backend Layer
    subgraph "Backend Layer"
        FastAPI["FastAPI API"]:::backend
        APIRoutes["API Routes"]:::backend
        Controllers["Controllers"]:::backend
        Models["ORM Models"]:::backend
        Schemas["Pydantic Schemas"]:::backend
        Session["DB Session Config"]:::backend
        Settings["App Settings"]:::backend

        subgraph "Image Services"
            StorageAbstraction["Storage Abstraction"]:::backend
            Thumbnailer["Thumbnailer Service"]:::backend
        end

        FastAPI -->|"routes defined"| APIRoutes
        APIRoutes -->|"invokes"| Controllers
        Controllers -->|"uses ORM"| Models
        Controllers -->|"validates via"| Schemas
        Controllers -->|"opens session"| Session
        Controllers -->|"loads config from"| Settings
        FastAPI -->|"uploads/downloads"| StorageAbstraction
        StorageAbstraction -->|"creates thumbnails"| Thumbnailer
    end

    %% Database and Migrations
    subgraph "Data Layer"
        DB["PostgreSQL/SQLite"]:::datastore
        AlembicIni["alembic.ini"]:::infra
        AlembicDir["Migrations Dir"]:::infra
        MigrateImagesBackend["Backend Migration Script"]:::infra
    end

    Controllers -->|"CRUD operations"| DB
    AlembicIni -->|"configures"| AlembicDir
    AlembicDir -->|"executes migrations"| DB
    MigrateImagesBackend -->|"data/image migrations"| DB

    %% Object Storage
    StorageAbstraction -->|"reads/writes"| ObjectStorage["Object Storage (Local FS/GCS)"]:::storage

    %% Deployment Infrastructure
    subgraph "Deployment"
        Dockerfile["Dockerfile"]:::infra
        GcpDocker["gcp.Dockerfile"]:::infra
        Entrypoint["entrypoint.sh"]:::infra
        Install["install.sh"]:::infra
        Gcsfuse["gcsfuse_run.sh"]:::infra
        Pyproject["pyproject.toml"]:::infra
        CopyDataScript["Global Script: copy_data.py"]:::infra
        GlobalMigrate["Global Script: migrate_images.py"]:::infra
        CI_CD["CI/CD Pipeline"]:::infra
        CloudRun["GCP Cloud Run"]:::infra
    end

    CI_CD -->|"builds image"| Dockerfile
    Dockerfile -->|"uses"| Entrypoint
    Dockerfile -->|"uses"| Install
    Dockerfile -->|"mounts"| Gcsfuse
    Dockerfile -->|"includes"| Pyproject
    CI_CD -->|"runs"| CopyDataScript
    CI_CD -->|"runs"| GlobalMigrate
    Dockerfile -->|"> push image"| CloudRun
    GcpDocker -->|"alternative build"| CloudRun

    %% Connections to Deployment
    VueJSApp -->|"built into image"| Dockerfile
    FastAPI -->|"packaged into image"| Dockerfile
    DB -.->|"external service"| Dockerfile
    ObjectStorage -.->|"mounted volume"| Dockerfile

    %% Click Events
    click VueJSApp "https://github.com/xyzjonas/chef/tree/master/src/js/chef"
    click ViteConfig "https://github.com/xyzjonas/chef/blob/master/src/js/chef/vite.config.ts"
    click UnoConfig "https://github.com/xyzjonas/chef/blob/master/src/js/chef/uno.config.ts"
    click Router "https://github.com/xyzjonas/chef/blob/master/src/js/chef/src/router/index.ts"
    click Stores "https://github.com/xyzjonas/chef/tree/master/src/js/chef/src/stores"
    click APIComposable "https://github.com/xyzjonas/chef/blob/master/src/js/chef/src/composables/api.ts"
    click FastAPI "https://github.com/xyzjonas/chef/blob/master/src/python/chef/main.py"
    click APIRoutes "https://github.com/xyzjonas/chef/tree/master/src/python/chef/api"
    click Controllers "https://github.com/xyzjonas/chef/blob/master/src/python/chef/controllers.py"
    click Models "https://github.com/xyzjonas/chef/blob/master/src/python/chef/models.py"
    click Schemas "https://github.com/xyzjonas/chef/blob/master/src/python/chef/schemas.py"
    click Session "https://github.com/xyzjonas/chef/blob/master/src/python/chef/session.py"
    click Settings "https://github.com/xyzjonas/chef/blob/master/src/python/chef/settings.py"
    click StorageAbstraction "https://github.com/xyzjonas/chef/blob/master/src/python/chef/image/storage.py"
    click Thumbnailer "https://github.com/xyzjonas/chef/blob/master/src/python/chef/image/thumbnailer.py"
    click MigrateImagesBackend "https://github.com/xyzjonas/chef/blob/master/src/python/chef/scripts/migrate_images.py"
    click AlembicIni "https://github.com/xyzjonas/chef/blob/master/alembic.ini"
    click AlembicDir "https://github.com/xyzjonas/chef/tree/master/src/python/migrations"
    click Dockerfile "https://github.com/xyzjonas/chef/tree/master/Dockerfile"
    click GcpDocker "https://github.com/xyzjonas/chef/blob/master/gcp.Dockerfile"
    click Entrypoint "https://github.com/xyzjonas/chef/blob/master/entrypoint.sh"
    click Install "https://github.com/xyzjonas/chef/blob/master/install.sh"
    click Gcsfuse "https://github.com/xyzjonas/chef/blob/master/gcsfuse_run.sh"
    click CopyDataScript "https://github.com/xyzjonas/chef/blob/master/scripts/copy_data.py"
    click GlobalMigrate "https://github.com/xyzjonas/chef/blob/master/scripts/migrate_images.py"
    click Pyproject "https://github.com/xyzjonas/chef/blob/master/pyproject.toml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px;
    classDef backend fill:#E6FFDE,stroke:#28A745,stroke-width:1px;
    classDef datastore fill:#FFE4B5,stroke:#FF8C00,stroke-width:1px,stroke-dasharray: 5 5;
    classDef storage fill:#FFFACD,stroke:#FFD700,stroke-width:1px;
    classDef infra fill:#F0F0F0,stroke:#6C757D,stroke-width:1px;
    classDef external fill:#FFFFFF,stroke:#CCCCCC,stroke-width:1px,stroke-dasharray: 2 2;
```
