# dechen17714/tabletap_scaling_project architecture

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

- Interactive diagram: https://gitdiagram.com/dechen17714/tabletap_scaling_project
- Repository: https://github.com/dechen17714/tabletap_scaling_project

## Overview

TableTap is a restaurant ordering platform: diners use QR-linked menus to place and track orders, while owners manage restaurant profiles, menus, tables, orders, and dashboard metrics. The main runtime path is browser UI → FastAPI routes → ORM-backed PostgreSQL state; owner authentication additionally uses Google OAuth. The sampled backend shows route-to-data and application routing, but the frontend implementation and several backend modules were not sampled, so UI/API wiring is shown only as unverified.

Main entry points: [`backend/app/main.py`](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/database.py`](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/database.py) (Database sessions), [`backend/app/models.py`](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/models.py) (Restaurant data models), [`backend/app/routers/menu.py`](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/menu.py) (Menu management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Restaurant experience"]
  node_frontend["Web interface<br/>[app.js]"]
end

subgraph group_api["Backend API"]
  node_app["FastAPI application<br/>[main.py]"]
  node_customer["Customer ordering<br/>[customer.py]"]
  node_auth_routes["OAuth routes<br/>[auth.py]"]
  node_menu["Menu management<br/>[menu.py]"]
  node_tables["Table and QR management<br/>[tables.py]"]
  node_orders_dashboard["Orders and dashboard<br/>[dashboard.py]"]
  node_owner_profile["Owner profile<br/>[owner.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_identity["Identity and configuration"]
  node_dependencies["Authentication dependency<br/>[dependencies.py]"]
  node_token_auth["Token helpers<br/>[auth.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

subgraph group_persistence["Persistence"]
  node_database_layer["Database sessions<br/>[database.py]"]
  node_models["Restaurant data models<br/>[models.py]"]
  node_postgres[("PostgreSQL<br/>[init.sql]")]
end

node_diner(("Diner"))
node_owner(("Restaurant owner"))
node_google["Google OAuth"]

node_diner -->|"browses and orders"| node_frontend
node_owner -->|"manages restaurant"| node_frontend
node_frontend -.->|"uses API"| node_app
node_app -->|"registers routes"| node_auth_routes
node_app -->|"registers routes"| node_customer
node_app -->|"registers routes"| node_menu
node_app -->|"registers routes"| node_tables
node_app -->|"registers routes"| node_orders_dashboard
node_app -->|"registers routes"| node_owner_profile
node_auth_routes -->|"exchanges OAuth"| node_google
node_auth_routes -->|"creates tokens"| node_token_auth
node_auth_routes -->|"looks up restaurant"| node_models
node_dependencies -->|"decodes token"| node_token_auth
node_dependencies -->|"gets session"| node_database_layer
node_dependencies -->|"loads restaurant"| node_models
node_database_layer -->|"reads database URL"| node_settings
node_database_layer -.->|"connects to"| node_postgres
node_customer -->|"queries and saves"| node_database_layer
node_customer -->|"uses entities"| node_models
node_menu -->|"queries and saves"| node_database_layer
node_menu -->|"uses entities"| node_models
node_menu -->|"serves uploaded images"| node_app
node_tables -->|"queries and saves"| node_database_layer
node_tables -->|"uses entities"| node_models
node_orders_dashboard -->|"queries and updates"| node_database_layer
node_orders_dashboard -->|"uses entities"| node_models
node_owner_profile -->|"persists profile"| node_database_layer
node_owner_profile -->|"updates restaurant"| node_models
node_orders_dashboard -->|"validates responses"| node_schemas
node_menu -->|"validates responses"| node_schemas
node_tables -->|"validates responses"| node_schemas
node_owner_profile -->|"validates responses"| node_schemas

click node_frontend "https://github.com/dechen17714/tabletap_scaling_project/blob/main/frontend/public/assets/js/app.js"
click node_app "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/main.py"
click node_customer "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/customer.py"
click node_auth_routes "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/auth.py"
click node_menu "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/menu.py"
click node_tables "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/tables.py"
click node_orders_dashboard "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/dashboard.py"
click node_owner_profile "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/owner.py"
click node_schemas "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/schemas.py"
click node_dependencies "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/dependencies.py"
click node_token_auth "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/auth.py"
click node_settings "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/config.py"
click node_database_layer "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/database.py"
click node_models "https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/models.py"
click node_postgres "https://github.com/dechen17714/tabletap_scaling_project/blob/main/database/init.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_frontend toneBlue
class node_app,node_customer,node_auth_routes,node_menu,node_tables,node_orders_dashboard,node_owner_profile,node_schemas toneAmber
class node_dependencies,node_token_auth,node_settings toneMint
class node_database_layer,node_models,node_postgres toneRose
class node_diner,node_owner,node_google toneIndigo
```

## Components

### Restaurant experience

- [Web interface](https://github.com/dechen17714/tabletap_scaling_project/blob/main/frontend/public/assets/js/app.js): `frontend/public/assets/js/app.js`

### Backend API

- [FastAPI application](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/main.py): `backend/app/main.py`
- [Customer ordering](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/customer.py): `backend/app/routers/customer.py`
- [OAuth routes](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Menu management](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/menu.py): `backend/app/routers/menu.py`
- [Table and QR management](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/tables.py): `backend/app/routers/tables.py`
- [Orders and dashboard](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`
- [Owner profile](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/routers/owner.py): `backend/app/routers/owner.py`
- [API schemas](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Identity and configuration

- [Authentication dependency](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/dependencies.py): `backend/app/dependencies.py`
- [Token helpers](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Runtime settings](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/config.py): `backend/app/config.py`

### Persistence

- [Database sessions](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/database.py): `backend/app/database.py`
- [Restaurant data models](https://github.com/dechen17714/tabletap_scaling_project/blob/main/backend/app/models.py): `backend/app/models.py`
- [PostgreSQL](https://github.com/dechen17714/tabletap_scaling_project/blob/main/database/init.sql): `database/init.sql`

### Other components

- **Diner**
- **Restaurant owner**
- **Google OAuth**

## Connections

- Diner → Web interface: browses and orders (evidence: `README.md`)
- Restaurant owner → Web interface: manages restaurant (evidence: `README.md`)
- Web interface → FastAPI application: uses API
- FastAPI application → OAuth routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Customer ordering: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Menu management: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Table and QR management: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Orders and dashboard: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Owner profile: registers routes (evidence: `backend/app/main.py`)
- OAuth routes → Google OAuth: exchanges OAuth (evidence: `backend/app/routers/auth.py`)
- OAuth routes → Token helpers: creates tokens (evidence: `backend/app/routers/auth.py`)
- OAuth routes → Restaurant data models: looks up restaurant (evidence: `backend/app/routers/auth.py`)
- Authentication dependency → Token helpers: decodes token (evidence: `backend/app/dependencies.py`)
- Authentication dependency → Database sessions: gets session (evidence: `backend/app/dependencies.py`)
- Authentication dependency → Restaurant data models: loads restaurant (evidence: `backend/app/dependencies.py`)
- Database sessions → Runtime settings: reads database URL (evidence: `backend/app/database.py`)
- Database sessions → PostgreSQL: connects to
- Customer ordering → Database sessions: queries and saves (evidence: `backend/app/routers/customer.py`)
- Customer ordering → Restaurant data models: uses entities (evidence: `backend/app/routers/customer.py`)
- Menu management → Database sessions: queries and saves (evidence: `backend/app/routers/menu.py`)
- Menu management → Restaurant data models: uses entities (evidence: `backend/app/routers/menu.py`)
- Menu management → FastAPI application: serves uploaded images (evidence: `backend/app/routers/menu.py`)
- Table and QR management → Database sessions: queries and saves (evidence: `backend/app/routers/tables.py`)
- Table and QR management → Restaurant data models: uses entities (evidence: `backend/app/routers/tables.py`)
- Orders and dashboard → Database sessions: queries and updates (evidence: `backend/app/routers/dashboard.py`)
- Orders and dashboard → Restaurant data models: uses entities (evidence: `backend/app/routers/dashboard.py`)
- Owner profile → Database sessions: persists profile (evidence: `backend/app/routers/owner.py`)
- Owner profile → Restaurant data models: updates restaurant (evidence: `backend/app/routers/owner.py`)
- Orders and dashboard → API schemas: validates responses (evidence: `backend/app/routers/dashboard.py`)
- Menu management → API schemas: validates responses (evidence: `backend/app/routers/menu.py`)
- Table and QR management → API schemas: validates responses (evidence: `backend/app/routers/tables.py`)
- Owner profile → API schemas: validates responses (evidence: `backend/app/routers/owner.py`)
