# theturefaded/cosc310-team19-food-delivery architecture

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

- Interactive diagram: https://gitdiagram.com/theturefaded/cosc310-team19-food-delivery
- Repository: https://github.com/theturefaded/cosc310-team19-food-delivery

## Overview

This repository is a small FastAPI backend for restaurant discovery and registration—not yet a complete food-delivery app. The principal workflow is an HTTP client request routed through the restaurant API to service logic, which reads restaurant records and, for additions, assigns an ID and checks duplicate names before persistence. The README also documents root and health checks. Menus, ordering, and delivery tracking are explicitly planned, not implemented here. The repository excerpt does not show its write implementation, so that relationship is supported by the README rather than inferred from the excerpt.

Main entry points: [`app/api/routes/restaurant_route.py`](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/api/routes/restaurant_route.py) (Restaurant routes), [`app/services/restaurant_service.py`](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/services/restaurant_service.py) (Restaurant service), [`app/main.py`](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/main.py) (FastAPI app), [`app/repositories/restaurant_repository.py`](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/repositories/restaurant_repository.py) (Restaurant repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_app["FastAPI app<br/>[main.py]"]
  node_routes["Restaurant routes"]
end

subgraph group_domain["Restaurant Logic"]
  node_schemas["Restaurant schemas<br/>[restaurant.py]"]
  node_service["Restaurant service"]
  node_errors["Domain errors<br/>[errors.py]"]
end

subgraph group_storage["Restaurant Storage"]
  node_repository["Restaurant repository"]
  node_data[("Restaurant JSON<br/>[restaurants.json]")]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_app
node_app -->|"registers routes"| node_routes
node_routes -->|"dispatches requests"| node_service
node_routes -->|"validates input"| node_schemas
node_service -->|"builds results"| node_schemas
node_service -->|"reads and writes"| node_repository
node_service -->|"raises domain errors"| node_errors
node_routes -->|"maps duplicates"| node_errors
node_repository -->|"reads and updates"| node_data

click node_app "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/main.py"
click node_routes "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/api/routes/restaurant_route.py"
click node_schemas "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/schemas/restaurant.py"
click node_service "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/services/restaurant_service.py"
click node_errors "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/errors.py"
click node_repository "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/repositories/restaurant_repository.py"
click node_data "https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/data/restaurants.json"

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_routes,node_client toneBlue
class node_schemas,node_service,node_errors toneAmber
class node_repository,node_data toneMint
```

## Components

### HTTP API

- [FastAPI app](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/main.py): `app/main.py`
- [Restaurant routes](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/api/routes/restaurant_route.py): `app/api/routes/restaurant_route.py`

### Restaurant Logic

- [Restaurant schemas](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/schemas/restaurant.py): `app/schemas/restaurant.py`
- [Restaurant service](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/services/restaurant_service.py): `app/services/restaurant_service.py`
- [Domain errors](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/errors.py): `app/errors.py`

### Restaurant Storage

- [Restaurant repository](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/app/repositories/restaurant_repository.py): `app/repositories/restaurant_repository.py`
- [Restaurant JSON](https://github.com/theturefaded/cosc310-team19-food-delivery/blob/main/data/restaurants.json): `data/restaurants.json`

### Other components

- **HTTP client**

## Connections

- HTTP client → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → Restaurant routes: registers routes (evidence: `app/main.py`)
- Restaurant routes → Restaurant service: dispatches requests (evidence: `app/api/routes/restaurant_route.py`)
- Restaurant routes → Restaurant schemas: validates input (evidence: `app/api/routes/restaurant_route.py`)
- Restaurant service → Restaurant schemas: builds results (evidence: `app/services/restaurant_service.py`)
- Restaurant service → Restaurant repository: reads and writes (evidence: `README.md`)
- Restaurant service → Domain errors: raises domain errors (evidence: `app/services/restaurant_service.py`)
- Restaurant routes → Domain errors: maps duplicates (evidence: `app/api/routes/restaurant_route.py`)
- Restaurant repository → Restaurant JSON: reads and updates (evidence: `README.md`)
