# henriquebragamoreira/gesture-pro architecture

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

- Interactive diagram: https://gitdiagram.com/henriquebragamoreira/gesture-pro
- Repository: https://github.com/henriquebragamoreira/gesture-pro

## Overview

##### Project type and purpose
- This is a full-stack web application named “Gesture Pro,” composed of:
- A backend API written in Python using FastAPI
- A frontend web client written in TypeScript using Next.js
- Purpose: CRUD operations and dashboard for managing categories, products and sales data.

##### File structure
- Top-level folders:
- api/ – FastAPI backend, with routers, models, schemas, database setup, Docker Compose
- web/ – Next.js frontend, with components, pages (app directory), services, hooks, styles
- Backend patterns:
- api/routers → endpoint grouping (categories, products, sales, dashboard)
- api/models & schemas → data models and validation
- api/database.py + database_setup.sql → PostgreSQL setup
- api/docker-compose.yaml → container orchestration
- Frontend patterns:
- app/(app) → Next.js 13 App Router, feature folders (categories, products, dashboard)
- components/ui → shared UI primitives
- services/* → API client wrappers (ky + TanStack Query)
- hooks & utils → cross-cutting concerns (pagination, debounce)

##### README for additional insights
- Tech stack: Python 3.8+, FastAPI, PostgreSQL, Docker Compose; Next.js 13+, pnpm
- Workflow:
- Start PostgreSQL via Docker Compose
- Seed DB with SQL & Python script
- Run backend (Uvicorn) on port 8000
- Run frontend (pnpm dev) on port 3000
- Interactive Swagger UI for API testing and standard lint/type checks for frontend

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    subgraph "Presentation Layer" 
        classDef frontend fill:#EDF2FF,stroke:#1E3A8A,color:#1E3A8A
        BROWSER["Browser"]:::external
        NEXTJS["Next.js App"]:::frontend
        BROWSER -->|"HTTP(S) GET/POST"| NEXTJS
    end

    subgraph "Frontend Components" 
        classDef frontend fill:#EDF2FF,stroke:#1E3A8A,color:#1E3A8A
        UI["UI Components"]:::frontend
        SERVICES["Service Layer"]:::frontend
        NEXTJS --> UI
        NEXTJS --> SERVICES
    end

    subgraph "Backend Layer"
        classDef backend fill:#E6FFFA,stroke:#065F46,color:#065F46
        FASTAPI["FastAPI Server"]:::backend
        UI -->|calls| SERVICES
        SERVICES -->|REST calls| FASTAPI
    end

    subgraph "Backend Internals"
        classDef backend fill:#E6FFFA,stroke:#065F46,color:#065F46
        ENTRY["Entry Point\napi/main.py"]:::backend
        ROUTERS["Routers\ncategories, products,\nsales, dashboard"]:::backend
        MODELS["Models & Schemas\napi/models.py\napi/schemas.py"]:::backend
        CRUD["CRUD Logic\napi/crud.py"]:::backend
        DB_CONF["DB Config\napi/database.py\napi/database_setup.sql"]:::backend
        SEED["Seed Script\napi/scripts/seed_database.py"]:::backend
        ENTRY --> ROUTERS
        ROUTERS --> CRUD
        CRUD --> MODELS
        CRUD --> DB_CONF
        SEED -.->|seeds| DB_CONF
        FASTAPI --> ENTRY
    end

    subgraph "Data Layer"
        classDef db fill:#F0FFF4,stroke:#047857,color:#047857
        POSTGRES["PostgreSQL DB"]:::db
        FASTAPI -->|SQLAlchemy/PostgreSQL via DATABASE_URL| POSTGRES
    end

    subgraph "Infrastructure"
        classDef infra fill:#F5F5F5,stroke:#6B7280,color:#374151
        DOCKER["Docker Compose\napi/docker-compose.yaml"]:::infra
        DOCKER --> POSTGRES
        DOCKER -.-> FASTAPI
    end

    %% Frontend Clicks
    click UI "https://github.com/henriquebragamoreira/gesture-pro/tree/main/web/src/components/ui"
    click SERVICES "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/services/categories/index.ts"
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/layout.tsx"
    %% Frontend App Router
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/(app)/categories/page.tsx"
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/(app)/products/page.tsx"
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/(app)/dashboard/page.tsx"
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/error.tsx"
    click NEXTJS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/web/src/app/providers.tsx"
    %% Backend Clicks
    click ENTRY "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/main.py"
    click ROUTERS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/routers/categories.py"
    click CRUD "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/crud.py"
    click MODELS "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/models.py"
    click DB_CONF "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/database.py"
    click SEED "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/scripts/seed_database.py"
    click DOCKER "https://github.com/henriquebragamoreira/gesture-pro/blob/main/api/docker-compose.yaml"

    %% Styles
    class BROWSER external
    classDef external fill:#FFFFFF,stroke:#9CA3AF,color:#374151
    class NEXTJS,UI,SERVICES frontend
    class FASTAPI,ENTRY,ROUTERS,MODELS,CRUD,DB_CONF,SEED backend
    class POSTGRES db
    class DOCKER infra
```
