# nelsondarosa/ft_machry architecture

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

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

## Overview

This is a Flask API for product lookup, inventory visibility, and production-request details. Clients call the registered feature endpoints; each route queries SQLite through the shared database helper and returns rows as JSON. The helper opens per-request connections and also provides a CLI command to initialize the database, optionally loading seed data. The excerpts establish these API and database paths, but the README is empty and the SQL contents were not shown, so schema-level behavior and additional capabilities cannot be confirmed.

Main entry points: [`app/db.py`](https://github.com/nelsondarosa/ft_machry/blob/main/app/db.py) (DB connections), [`app/__init__.py`](https://github.com/nelsondarosa/ft_machry/blob/main/app/__init__.py) (Flask app), [`app/features/produtos/routes.py`](https://github.com/nelsondarosa/ft_machry/blob/main/app/features/produtos/routes.py) (Product listing), [`app/features/estoque/routes.py`](https://github.com/nelsondarosa/ft_machry/blob/main/app/features/estoque/routes.py) (Inventory views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API application"]
  node_application["Flask app<br/>[__init__.py]"]
  node_configuration["DB configuration<br/>[config.py]"]
end

subgraph group_features["Product features"]
  node_products["Product listing<br/>[routes.py]"]
  node_inventory["Inventory views<br/>[routes.py]"]
  node_production["Production requests<br/>[routes.py]"]
end

subgraph group_persistence["Persistence"]
  node_dbhelper["DB connections<br/>[db.py]"]
  node_sqlite[("SQLite database")]
  node_schema["Database schema<br/>[schema.sql]"]
  node_seeds["Seed data<br/>[seeds.sql]"]
end

node_client(("API client"))

node_client -->|"calls API"| node_application
node_application -->|"loads settings"| node_configuration
node_application -->|"registers routes"| node_products
node_application -->|"registers routes"| node_inventory
node_application -->|"registers routes"| node_production
node_products -->|"queries via"| node_dbhelper
node_inventory -->|"queries via"| node_dbhelper
node_production -->|"queries via"| node_dbhelper
node_dbhelper -->|"opens connection"| node_sqlite
node_dbhelper -->|"loads schema"| node_schema
node_dbhelper -->|"optionally loads"| node_seeds

click node_application "https://github.com/nelsondarosa/ft_machry/blob/main/app/__init__.py"
click node_configuration "https://github.com/nelsondarosa/ft_machry/blob/main/app/config.py"
click node_products "https://github.com/nelsondarosa/ft_machry/blob/main/app/features/produtos/routes.py"
click node_inventory "https://github.com/nelsondarosa/ft_machry/blob/main/app/features/estoque/routes.py"
click node_production "https://github.com/nelsondarosa/ft_machry/blob/main/app/features/producao/routes.py"
click node_dbhelper "https://github.com/nelsondarosa/ft_machry/blob/main/app/db.py"
click node_schema "https://github.com/nelsondarosa/ft_machry/blob/main/db/schema.sql"
click node_seeds "https://github.com/nelsondarosa/ft_machry/blob/main/db/seeds.sql"

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_application,node_configuration,node_client toneBlue
class node_products,node_inventory,node_production toneAmber
class node_dbhelper,node_sqlite,node_schema,node_seeds toneMint
```

## Components

### API application

- [Flask app](https://github.com/nelsondarosa/ft_machry/blob/main/app/__init__.py): `app/__init__.py`
- [DB configuration](https://github.com/nelsondarosa/ft_machry/blob/main/app/config.py): `app/config.py`

### Product features

- [Product listing](https://github.com/nelsondarosa/ft_machry/blob/main/app/features/produtos/routes.py): `app/features/produtos/routes.py`
- [Inventory views](https://github.com/nelsondarosa/ft_machry/blob/main/app/features/estoque/routes.py): `app/features/estoque/routes.py`
- [Production requests](https://github.com/nelsondarosa/ft_machry/blob/main/app/features/producao/routes.py): `app/features/producao/routes.py`

### Persistence

- [DB connections](https://github.com/nelsondarosa/ft_machry/blob/main/app/db.py): `app/db.py`
- **SQLite database**
- [Database schema](https://github.com/nelsondarosa/ft_machry/blob/main/db/schema.sql): `db/schema.sql`
- [Seed data](https://github.com/nelsondarosa/ft_machry/blob/main/db/seeds.sql): `db/seeds.sql`

### Other components

- **API client**

## Connections

- API client → Flask app: calls API (evidence: `app/__init__.py`)
- Flask app → DB configuration: loads settings (evidence: `app/__init__.py`)
- Flask app → Product listing: registers routes (evidence: `app/__init__.py`)
- Flask app → Inventory views: registers routes (evidence: `app/__init__.py`)
- Flask app → Production requests: registers routes (evidence: `app/__init__.py`)
- Product listing → DB connections: queries via (evidence: `app/features/produtos/routes.py`)
- Inventory views → DB connections: queries via (evidence: `app/features/estoque/routes.py`)
- Production requests → DB connections: queries via (evidence: `app/features/producao/routes.py`)
- DB connections → SQLite database: opens connection (evidence: `app/db.py`)
- DB connections → Database schema: loads schema (evidence: `app/db.py`)
- DB connections → Seed data: optionally loads (evidence: `app/db.py`)
