# emrick-r/ytastycrousty-g3 architecture

> Architecture diagram of the GitHub repository emrick-r/ytastycrousty-g3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/emrick-r/ytastycrousty-g3
- Repository: https://github.com/emrick-r/ytastycrousty-g3

## Overview

Ytasty Crousty is a FastAPI ordering backend for three restaurants. Customers browse the restaurant catalog, place orders, and track them; staff and administrators manage products and order status, while role-based access also supports account and restaurant administration. The graph separates those domain routes from authentication, persistence, and startup seeding. The README documents the restaurant management capabilities; the restaurants router and several order and model implementations were not sampled, so their internal call details are not inferred.

Main entry points: [`src/db/database.py`](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/db/database.py) (Database sessions), [`src/main.py`](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/main.py) (FastAPI application), [`src/models`](https://github.com/emrick-r/ytastycrousty-g3/tree/main/src/models) (Domain models), [`src/routers/auth.py`](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/auth.py) (Login and users)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API domains"]
  node_app["FastAPI application<br/>[main.py]"]
  node_restaurants["Restaurant management<br/>[restaurants.py]"]
  node_products["Product catalog<br/>[products.py]"]
  node_orders["Order lifecycle<br/>[orders.py]"]
end

subgraph group_security["Identity and access"]
  node_auth["Login and users<br/>[auth.py]"]
  node_access["Role authorization<br/>[deps.py]"]
  node_security_impl["JWT and password security<br/>[security.py]"]
end

subgraph group_data["Persistence and startup"]
  node_database["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_models["Domain models"]
  node_seed["Initial data seeding<br/>[seed.py]"]
end

node_client(("API consumer"))

node_client -->|"calls API"| node_app
node_app -->|"dispatches"| node_restaurants
node_app -->|"dispatches"| node_products
node_app -->|"dispatches"| node_orders
node_app -->|"dispatches"| node_auth
node_app -->|"creates tables"| node_database
node_app -->|"initializes data"| node_seed
node_auth -->|"uses sessions"| node_database
node_restaurants -->|"uses sessions"| node_database
node_products -->|"uses sessions"| node_database
node_orders -->|"uses sessions"| node_database
node_auth -->|"checks credentials, signs token"| node_security_impl
node_access -->|"verifies token"| node_security_impl
node_auth -->|"protects user routes"| node_access
node_products -->|"checks access"| node_access
node_orders -->|"checks access"| node_access
node_database -->|"queries and persists"| node_postgres
node_seed -->|"writes initial records"| node_database
node_seed -->|"hashes passwords"| node_security_impl
node_database -->|"maps domain tables"| node_models
node_seed -->|"creates records"| node_models
node_auth -->|"reads and writes users"| node_models
node_restaurants -->|"reads and writes restaurants"| node_models
node_products -->|"reads and writes products"| node_models
node_orders -->|"reads and writes orders"| node_models

click node_app "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/main.py"
click node_restaurants "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/restaurants.py"
click node_products "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/products.py"
click node_orders "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/orders.py"
click node_auth "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/auth.py"
click node_access "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/core/deps.py"
click node_security_impl "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/core/security.py"
click node_database "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/db/database.py"
click node_models "https://github.com/emrick-r/ytastycrousty-g3/tree/main/src/models"
click node_seed "https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/db/seed.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_app,node_restaurants,node_products,node_orders toneBlue
class node_auth,node_access,node_security_impl toneAmber
class node_database,node_postgres,node_models,node_seed,node_client toneMint
```

## Components

### API domains

- [FastAPI application](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/main.py): `src/main.py`
- [Restaurant management](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/restaurants.py): `src/routers/restaurants.py`
- [Product catalog](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/products.py): `src/routers/products.py`
- [Order lifecycle](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/orders.py): `src/routers/orders.py`

### Identity and access

- [Login and users](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/routers/auth.py): `src/routers/auth.py`
- [Role authorization](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/core/deps.py): `src/core/deps.py`
- [JWT and password security](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/core/security.py): `src/core/security.py`

### Persistence and startup

- [Database sessions](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/db/database.py): `src/db/database.py`
- **PostgreSQL**
- [Domain models](https://github.com/emrick-r/ytastycrousty-g3/tree/main/src/models): `src/models`
- [Initial data seeding](https://github.com/emrick-r/ytastycrousty-g3/blob/main/src/db/seed.py): `src/db/seed.py`

### Other components

- **API consumer**

## Connections

- API consumer → FastAPI application: calls API
- FastAPI application → Restaurant management: dispatches
- FastAPI application → Product catalog: dispatches
- FastAPI application → Order lifecycle: dispatches
- FastAPI application → Login and users: dispatches
- FastAPI application → Database sessions: creates tables
- FastAPI application → Initial data seeding: initializes data
- Login and users → Database sessions: uses sessions
- Restaurant management → Database sessions: uses sessions
- Product catalog → Database sessions: uses sessions
- Order lifecycle → Database sessions: uses sessions
- Login and users → JWT and password security: checks credentials, signs token
- Role authorization → JWT and password security: verifies token
- Login and users → Role authorization: protects user routes
- Product catalog → Role authorization: checks access
- Order lifecycle → Role authorization: checks access
- Database sessions → PostgreSQL: queries and persists
- Initial data seeding → Database sessions: writes initial records
- Initial data seeding → JWT and password security: hashes passwords
- Database sessions → Domain models: maps domain tables
- Initial data seeding → Domain models: creates records
- Login and users → Domain models: reads and writes users
- Restaurant management → Domain models: reads and writes restaurants
- Product catalog → Domain models: reads and writes products
- Order lifecycle → Domain models: reads and writes orders
