# gabrielhenriqcs/ondemanda architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielhenriqcs/ondemanda
- Repository: https://github.com/gabrielhenriqcs/ondemanda

## Overview

This is a restaurant table, order, and kitchen-management application with a React frontend and an Express/Prisma backend. The visible user journey covers login and routed views for table commands, kitchen work, and administration; backend services model opening and closing tabs and creating and updating orders. The sampled sources confirm authentication and selected database operations, but do not show the command/order controllers or frontend page-to-service calls, so those links are left out. The backend routes shown expose login and user routes only.

Main entry points: [`frontend/src/pages/routes.tsx`](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/routes.tsx) (Page routing), [`backend/src/helpers/prisma.ts`](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/helpers/prisma.ts) (Prisma client), [`frontend/src/services/api.ts`](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/api.ts) (HTTP client), [`backend/src/routes/routes.ts`](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/routes/routes.ts) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_navigation["Page routing<br/>[routes.tsx]"]
  node_login_page["Login screen<br/>[Login.tsx]"]
  node_command_page["Table commands<br/>[Comanda.tsx]"]
  node_kitchen_page["Kitchen view<br/>[Cozinha.tsx]"]
  node_dashboard["Admin dashboard<br/>[Dashboard.tsx]"]
  node_layout["App layout<br/>[Layout.tsx]"]
  node_api_client["HTTP client<br/>[api.ts]"]
  node_auth_front["Auth client<br/>[authService.ts]"]
  node_comanda_front["Command client<br/>[comandaService.ts]"]
  node_pedido_front["Order client<br/>[pedidoService.ts]"]
  node_mesa_front["Table client<br/>[mesaService.ts]"]
  node_item_front["Item client<br/>[ItemService.ts]"]
end

subgraph group_backend["Backend"]
  node_app["Express app<br/>[app.ts]"]
  node_routes["API routes<br/>[routes.ts]"]
  node_auth_controller["Auth controller<br/>[AuthController.ts]"]
  node_users_controller["Users controller"]
end

subgraph group_domain["Restaurant operations"]
  node_auth_service["Authentication<br/>[AuthService.ts]"]
  node_users_service["User management<br/>[UsuarioService.ts]"]
  node_comanda_service["Tab lifecycle<br/>[ComandaService.ts]"]
  node_pedido_service["Order handling<br/>[PedidoService.ts]"]
  node_mesa_service["Table management<br/>[MesaService.ts]"]
  node_item_service["Menu items<br/>[ItemService.ts]"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_database[("Application database")]
end

node_staff(("Staff user"))

node_staff -->|"opens views"| node_navigation
node_navigation -->|"routes to"| node_login_page
node_navigation -->|"routes to"| node_command_page
node_navigation -->|"routes to"| node_kitchen_page
node_navigation -->|"routes to"| node_dashboard
node_navigation -->|"wraps views"| node_layout
node_auth_front -->|"sends requests"| node_api_client
node_comanda_front -->|"sends requests"| node_api_client
node_pedido_front -->|"sends requests"| node_api_client
node_mesa_front -->|"sends requests"| node_api_client
node_item_front -->|"sends requests"| node_api_client
node_app -->|"mounts routes"| node_routes
node_routes -->|"dispatches login"| node_auth_controller
node_routes -->|"dispatches users"| node_users_controller
node_auth_controller -->|"calls login"| node_auth_service
node_users_controller -->|"lists users"| node_users_service
node_auth_service -->|"reads user"| node_prisma
node_users_service -->|"accesses data"| node_prisma
node_comanda_service -->|"reads and updates"| node_prisma
node_pedido_service -->|"reads and writes"| node_prisma
node_prisma -->|"queries"| node_database

click node_navigation "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/routes.tsx"
click node_login_page "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Login.tsx"
click node_command_page "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Comanda.tsx"
click node_kitchen_page "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Cozinha.tsx"
click node_dashboard "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Admin/Dashboard.tsx"
click node_layout "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/Layout.tsx"
click node_api_client "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/api.ts"
click node_auth_front "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/authService.ts"
click node_comanda_front "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/comandaService.ts"
click node_pedido_front "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/pedidoService.ts"
click node_mesa_front "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/mesaService.ts"
click node_item_front "https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/ItemService.ts"
click node_app "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/app.ts"
click node_routes "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/routes/routes.ts"
click node_auth_controller "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/controllers/AuthController.ts"
click node_users_controller "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/controllers/UsuariosController.ts"
click node_auth_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/AuthService.ts"
click node_users_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/UsuarioService.ts"
click node_comanda_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/ComandaService.ts"
click node_pedido_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/PedidoService.ts"
click node_mesa_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/MesaService.ts"
click node_item_service "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/ItemService.ts"
click node_prisma "https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/helpers/prisma.ts"

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_navigation,node_login_page,node_command_page,node_kitchen_page,node_dashboard,node_layout,node_api_client,node_auth_front,node_comanda_front,node_pedido_front,node_mesa_front,node_item_front,node_staff toneBlue
class node_app,node_routes,node_auth_controller,node_users_controller toneAmber
class node_auth_service,node_users_service,node_comanda_service,node_pedido_service,node_mesa_service,node_item_service toneMint
class node_prisma,node_database toneRose
```

## Components

### Frontend

- [Page routing](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/routes.tsx): `frontend/src/pages/routes.tsx`
- [Login screen](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Table commands](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Comanda.tsx): `frontend/src/pages/Comanda.tsx`
- [Kitchen view](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Cozinha.tsx): `frontend/src/pages/Cozinha.tsx`
- [Admin dashboard](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/pages/Admin/Dashboard.tsx): `frontend/src/pages/Admin/Dashboard.tsx`
- [App layout](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/Layout.tsx): `frontend/src/Layout.tsx`
- [HTTP client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Auth client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Command client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/comandaService.ts): `frontend/src/services/comandaService.ts`
- [Order client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/pedidoService.ts): `frontend/src/services/pedidoService.ts`
- [Table client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/mesaService.ts): `frontend/src/services/mesaService.ts`
- [Item client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/frontend/src/services/ItemService.ts): `frontend/src/services/ItemService.ts`

### Backend

- [Express app](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [API routes](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/routes/routes.ts): `backend/src/routes/routes.ts`
- [Auth controller](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/controllers/AuthController.ts): `backend/src/controllers/AuthController.ts`
- [Users controller](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/controllers/UsuariosController.ts): `backend/src/controllers/UsuariosController.ts`

### Restaurant operations

- [Authentication](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/AuthService.ts): `backend/src/services/AuthService.ts`
- [User management](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/UsuarioService.ts): `backend/src/services/UsuarioService.ts`
- [Tab lifecycle](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/ComandaService.ts): `backend/src/services/ComandaService.ts`
- [Order handling](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/PedidoService.ts): `backend/src/services/PedidoService.ts`
- [Table management](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/MesaService.ts): `backend/src/services/MesaService.ts`
- [Menu items](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/services/ItemService.ts): `backend/src/services/ItemService.ts`

### Persistence

- [Prisma client](https://github.com/gabrielhenriqcs/ondemanda/blob/main/backend/src/helpers/prisma.ts): `backend/src/helpers/prisma.ts`
- **Application database**

### Other components

- **Staff user**

## Connections

- Staff user → Page routing: opens views
- Page routing → Login screen: routes to
- Page routing → Table commands: routes to
- Page routing → Kitchen view: routes to
- Page routing → Admin dashboard: routes to
- Page routing → App layout: wraps views
- Auth client → HTTP client: sends requests
- Command client → HTTP client: sends requests
- Order client → HTTP client: sends requests
- Table client → HTTP client: sends requests
- Item client → HTTP client: sends requests
- Express app → API routes: mounts routes
- API routes → Auth controller: dispatches login
- API routes → Users controller: dispatches users
- Auth controller → Authentication: calls login
- Users controller → User management: lists users
- Authentication → Prisma client: reads user
- User management → Prisma client: accesses data
- Tab lifecycle → Prisma client: reads and updates
- Order handling → Prisma client: reads and writes
- Prisma client → Application database: queries
