# gabrielhadad/ft_machry architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielhadad/ft_machry
- Repository: https://github.com/gabrielhadad/ft_machry

## Overview

Cozinha+ is restaurant-operations software: staff use a React interface to manage catalog items and technical sheets, operate stock and locations, plan/complete production, and administer users and access groups through a Flask API backed by SQLAlchemy. The documented production workflow consumes recipe components using FEFO and adds the finished product to stock. The index supports several backend route-to-service and service-to-repository links; unsampled frontend feature wiring is not inferred, so those links are omitted.

Main entry points: [`db/database_config.py`](https://github.com/gabrielhadad/ft_machry/blob/main/db/database_config.py) (SQLAlchemy database), [`frontend/src/app/router.tsx`](https://github.com/gabrielhadad/ft_machry/blob/main/frontend/src/app/router.tsx) (Page routing), [`app/features/estoque/services.py`](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/services.py) (Stock domain), [`app/features/producao/services.py`](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/producao/services.py) (Production domain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_webapp["Application shell<br/>[App.tsx]"]
  node_navigation["Page routing<br/>[router.tsx]"]
  node_product_ui["Product catalog UI"]
  node_recipe_ui["Technical sheets UI"]
  node_stock_ui["Stock operations UI"]
  node_production_ui["Production UI"]
end

subgraph group_catalog["Catalog and recipes"]
  node_product_api["Product endpoints<br/>[routes.py]"]
  node_product_service["Product domain<br/>[services.py]"]
  node_recipe_api["Recipe endpoints<br/>[routes.py]"]
  node_recipe_service["Recipe domain<br/>[services.py]"]
end

subgraph group_operations["Stock and production"]
  node_stock_api["Stock endpoints<br/>[routes.py]"]
  node_stock_service["Stock domain<br/>[services.py]"]
  node_stock_repository["Stock persistence<br/>[repository.py]"]
  node_production_api["Production endpoints<br/>[routes.py]"]
  node_production_service["Production domain<br/>[services.py]"]
  node_location_api["Location endpoints<br/>[routes.py]"]
end

subgraph group_identity["Identity and access"]
  node_access_api["Access-group endpoints<br/>[routes.py]"]
  node_access_repository["Access persistence<br/>[repository.py]"]
  node_user_api["User endpoints<br/>[routes.py]"]
  node_auth_api["Session endpoints<br/>[routes.py]"]
  node_auth_middleware["Authentication middleware<br/>[autenticacao.py]"]
end

subgraph group_platform["API and persistence"]
  node_database[("SQLAlchemy database<br/>[database_config.py]")]
end

node_staff(("Restaurant staff"))

node_staff -->|"uses"| node_webapp
node_webapp -->|"selects views"| node_navigation
node_navigation -->|"routes to"| node_product_ui
node_navigation -->|"routes to"| node_recipe_ui
node_navigation -->|"routes to"| node_stock_ui
node_navigation -->|"routes to"| node_production_ui
node_webapp -->|"loads shared data"| node_database
node_product_api -->|"delegates to"| node_product_service
node_recipe_api -->|"delegates to"| node_recipe_service
node_stock_api -->|"delegates to"| node_stock_service
node_location_api -->|"delegates to"| node_stock_service
node_stock_service -->|"uses persistence"| node_stock_repository
node_access_api -->|"uses persistence"| node_access_repository
node_production_api -->|"delegates to"| node_production_service
node_production_service -.->|"consumes FEFO stock"| node_stock_service
node_production_service -.->|"adds finished goods"| node_stock_service
node_auth_api -->|"checks groups"| node_access_repository
node_auth_api -->|"uses user records"| node_user_api
node_auth_middleware -->|"resolves permissions"| node_access_repository
node_access_repository -->|"queries"| node_database
node_stock_repository -->|"queries and writes"| node_database
node_product_service -.->|"persists domain data"| node_database
node_recipe_service -.->|"persists domain data"| node_database
node_production_service -.->|"persists production"| node_database

click node_webapp "https://github.com/gabrielhadad/ft_machry/blob/main/frontend/src/app/App.tsx"
click node_navigation "https://github.com/gabrielhadad/ft_machry/blob/main/frontend/src/app/router.tsx"
click node_product_ui "https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/produtos"
click node_recipe_ui "https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/fichas"
click node_stock_ui "https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/estoque"
click node_production_ui "https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/producao"
click node_product_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/produtos/routes.py"
click node_product_service "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/produtos/services.py"
click node_recipe_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/fichas_tecnicas/routes.py"
click node_recipe_service "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/fichas_tecnicas/services.py"
click node_stock_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/routes.py"
click node_stock_service "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/services.py"
click node_stock_repository "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/repository.py"
click node_production_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/producao/routes.py"
click node_production_service "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/producao/services.py"
click node_location_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/routes.py"
click node_access_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/acessos/routes.py"
click node_access_repository "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/acessos/repository.py"
click node_user_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/usuarios/routes.py"
click node_auth_api "https://github.com/gabrielhadad/ft_machry/blob/main/app/features/auth/routes.py"
click node_auth_middleware "https://github.com/gabrielhadad/ft_machry/blob/main/app/middleware/autenticacao.py"
click node_database "https://github.com/gabrielhadad/ft_machry/blob/main/db/database_config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_navigation,node_product_ui,node_recipe_ui,node_stock_ui,node_production_ui toneBlue
class node_product_api,node_product_service,node_recipe_api,node_recipe_service toneAmber
class node_stock_api,node_stock_service,node_stock_repository,node_production_api,node_production_service,node_location_api toneMint
class node_access_api,node_access_repository,node_user_api,node_auth_api,node_auth_middleware toneRose
class node_database,node_staff toneIndigo
```

## Components

### Web interface

- [Application shell](https://github.com/gabrielhadad/ft_machry/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Page routing](https://github.com/gabrielhadad/ft_machry/blob/main/frontend/src/app/router.tsx): `frontend/src/app/router.tsx`
- [Product catalog UI](https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/produtos): `frontend/src/features/produtos`
- [Technical sheets UI](https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/fichas): `frontend/src/features/fichas`
- [Stock operations UI](https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/estoque): `frontend/src/features/estoque`
- [Production UI](https://github.com/gabrielhadad/ft_machry/tree/main/frontend/src/features/producao): `frontend/src/features/producao`

### Catalog and recipes

- [Product endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/produtos/routes.py): `app/features/produtos/routes.py`
- [Product domain](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/produtos/services.py): `app/features/produtos/services.py`
- [Recipe endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/fichas_tecnicas/routes.py): `app/features/fichas_tecnicas/routes.py`
- [Recipe domain](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/fichas_tecnicas/services.py): `app/features/fichas_tecnicas/services.py`

### Stock and production

- [Stock endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/routes.py): `app/features/estoque/routes.py`
- [Stock domain](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/services.py): `app/features/estoque/services.py`
- [Stock persistence](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/repository.py): `app/features/estoque/repository.py`
- [Production endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/producao/routes.py): `app/features/producao/routes.py`
- [Production domain](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/producao/services.py): `app/features/producao/services.py`
- [Location endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/estoque/routes.py): `app/features/estoque/routes.py`

### Identity and access

- [Access-group endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/acessos/routes.py): `app/features/acessos/routes.py`
- [Access persistence](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/acessos/repository.py): `app/features/acessos/repository.py`
- [User endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/usuarios/routes.py): `app/features/usuarios/routes.py`
- [Session endpoints](https://github.com/gabrielhadad/ft_machry/blob/main/app/features/auth/routes.py): `app/features/auth/routes.py`
- [Authentication middleware](https://github.com/gabrielhadad/ft_machry/blob/main/app/middleware/autenticacao.py): `app/middleware/autenticacao.py`

### API and persistence

- [SQLAlchemy database](https://github.com/gabrielhadad/ft_machry/blob/main/db/database_config.py): `db/database_config.py`

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → Application shell: uses
- Application shell → Page routing: selects views (evidence: `frontend/src/app/App.tsx`)
- Page routing → Product catalog UI: routes to (evidence: `frontend/src/app/router.tsx`)
- Page routing → Technical sheets UI: routes to (evidence: `frontend/src/app/router.tsx`)
- Page routing → Stock operations UI: routes to (evidence: `frontend/src/app/router.tsx`)
- Page routing → Production UI: routes to (evidence: `frontend/src/app/router.tsx`)
- Application shell → SQLAlchemy database: loads shared data (evidence: `frontend/src/app/App.tsx`)
- Product endpoints → Product domain: delegates to (evidence: `app/features/produtos/routes.py`)
- Recipe endpoints → Recipe domain: delegates to (evidence: `app/features/fichas_tecnicas/routes.py`)
- Stock endpoints → Stock domain: delegates to (evidence: `app/features/estoque/routes.py`)
- Location endpoints → Stock domain: delegates to (evidence: `app/features/estoque/routes.py`)
- Stock domain → Stock persistence: uses persistence (evidence: `app/features/estoque/services.py`)
- Access-group endpoints → Access persistence: uses persistence (evidence: `app/features/acessos/routes.py`)
- Production endpoints → Production domain: delegates to (evidence: `app/features/producao/routes.py`)
- Production domain → Stock domain: consumes FEFO stock
- Production domain → Stock domain: adds finished goods
- Session endpoints → Access persistence: checks groups (evidence: `app/features/auth/routes.py`)
- Session endpoints → User endpoints: uses user records (evidence: `app/features/auth/routes.py`)
- Authentication middleware → Access persistence: resolves permissions (evidence: `app/middleware/autenticacao.py`)
- Access persistence → SQLAlchemy database: queries (evidence: `app/features/acessos/repository.py`)
- Stock persistence → SQLAlchemy database: queries and writes (evidence: `app/features/estoque/repository.py`)
- Product domain → SQLAlchemy database: persists domain data
- Recipe domain → SQLAlchemy database: persists domain data
- Production domain → SQLAlchemy database: persists production
