# arman-miaa/order-nest architecture

> Architecture diagram of the GitHub repository arman-miaa/order-nest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arman-miaa/order-nest
- Repository: https://github.com/arman-miaa/order-nest

## Overview

1. This is a Next.js App Router repository for a restaurant operations platform, likely covering admin/manager/staff/kitchen workflows. The app is organized as a multi-role UI rather than a single generic site.

2. The top-level architectural boundary is the `src/app` route tree. Route groups split the experience into `defaultLayout` for public/home pages, `auth` for login and password recovery, and `dashboardLayout` for authenticated role-based application areas.

3. The dashboard is subdivided by role and function:
   - `manager` for analytics, floor/table management, menu admin, orders, settings, alerts, and user management
   - `staff` for taking orders, table/service workflows, ready-to-serve queues, and staff dashboard views
   - `kitchen` for kitchen dashboard, order queue, item status, stations, and display views
   - `admin` for a separate admin dashboard entry point
   These are distinct feature surfaces, each with its own route pages and feature components.

4. The `components/` directory contains most of the real implementation. Pages in `src/app` are thin route shells that compose domain components from `components/dashboard/...`, `components/module/...`, and `components/shared/...`. This separation indicates a “route as composition layer, components as feature layer” design.

5. State and server data are centralized through Redux and RTK Query. `redux/store.ts`, `redux/features/*`, and `redux/api/*` provide the global client state and API integration. Separate API slices exist for auth, events, members, notifications, restaurant data, uploads, and users, which suggests the app depends heavily on backend CRUD plus live operational data.

6. Authentication is a first-class subsystem. There is a NextAuth route under `src/app/api/auth/[...nextauth]`, a `NextAuthSessionProvider`, and dedicated auth components for login, signup, OTP verification, password reset, and password change. Authorization is likely role-driven, reinforced by `components/shared/role-route-page.tsx` and the dashboard segmentation.

7. The restaurant domain models and transformations are isolated in shared types and utilities. `components/dashboard/shared/types/restaurant.types.ts`, `src/types/*`, and normalization helpers in `src/utils/api-normalize.ts` and `src/utils/restaurant-normalize.ts` indicate a boundary between raw API payloads and UI-friendly models.

8. Real-time or near-real-time operations appear important. The presence of `src/utils/socket.ts`, queue/order feeds, kitchen alerts, and live dashboard widgets implies websocket or socket-based updates for orders, status changes, and operational notifications.

9. There is a reusable UI foundation underneath the feature screens. `components/ui/*` and `components/ui/core/*` provide primitive controls and higher-order widgets such as tables, modals, image uploaders, and custom selects. This looks like a shared design system layered on top of app-specific features, likely using shadcn-style component patterns.

10. Forms are standardized through `components/form/*` and feature-specific form hooks. Validation schemas live under `src/schema/*`, while form controls are wrapped in reusable inputs/selects/date pickers. This suggests form-heavy CRUD flows for menu, tables, users, settings, and order creation.

11. The main user workflows are:
   - staff creates and tracks orders from menu/table context
   - kitchen consumes those orders in queues and station views
   - managers inspect analytics, floor status, menus, alerts, and table operations
   - authenticated users navigate through role-specific dashboards after login
   The architecture supports a pipeline from order capture to kitchen fulfillment to serving/status updates.

12. Visual and layout concerns are separated from business logic. Shared layout elements such as navbar, sidebar, footer, loading states, and banner components sit outside the role features, while each dashboard area has its own cards, feeds, charts, and panels. This keeps navigation chrome and content modules decoupled.

13. Operationally, the project is a standard Next.js app with client-side Redux, app-router layouts, and API integration rather than a microservice repository. The important architecture diagram should show `src/app` as route composition, `components/` as feature/UI implementation, `redux/` as client data layer, and `src/utils`/`src/hooks` as supporting cross-cutting concerns.

Main entry points: [`redux/store.ts`](https://github.com/arman-miaa/order-nest/blob/main/redux/store.ts) (Redux store), [`src/app/(dashboardLayout)/manager`](https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/manager) (Manager routes), [`src/app/(dashboardLayout)/layout.tsx`](https://github.com/arman-miaa/order-nest/blob/main/src/app/(dashboardLayout)/layout.tsx) (Dashboard layout), [`src/utils`](https://github.com/arman-miaa/order-nest/tree/main/src/utils) (Runtime utils)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App routes"]
  node_root_layout["Root layout<br/>next layout<br/>[layout.tsx]"]
  node_default_layout["Public layout<br/>route layout<br/>[layout.tsx]"]
  node_dashboard_layout["Dashboard layout<br/>route layout<br/>[layout.tsx]"]
  node_auth_routes["Auth routes<br/>route group"]
  node_manager_routes["Manager routes<br/>route group"]
  node_staff_routes["Staff routes<br/>route group"]
  node_kitchen_routes["Kitchen routes<br/>route group"]
end

subgraph group_features["Feature components"]
  node_auth_pages["Auth pages<br/>auth screens"]
  node_manager_dashboard["Manager dashboard<br/>analytics view"]
  node_floor_mgmt["Floor management<br/>ops view"]
  node_menu_mgmt["Menu manager<br/>catalog admin"]
  node_order_admin["Order admin<br/>ops view"]
  node_staff_ops["Staff ops<br/>service workflow"]
  node_kitchen_ops["Kitchen ops<br/>fulfillment workflow"]
end

subgraph group_state["State and data"]
  node_redux_store["Redux store<br/>client state<br/>[store.ts]"]
  node_api_slices["API slices<br/>rtk query"]
  node_domain_types["Domain models<br/>shared types"]
  node_runtime_utils["Runtime utils<br/>support code"]
end

subgraph group_shared["Shared foundation"]
  node_ui_kit["UI kit<br/>design system"]
  node_form_system["Form system<br/>form layer"]
  node_chrome["App chrome<br/>layout chrome"]
end

node_root_layout -->|"wraps"| node_default_layout
node_root_layout -->|"wraps"| node_dashboard_layout
node_root_layout -->|"hosts"| node_auth_routes
node_default_layout -->|"uses"| node_chrome
node_dashboard_layout -->|"hosts"| node_manager_routes
node_dashboard_layout -->|"hosts"| node_staff_routes
node_dashboard_layout -->|"hosts"| node_kitchen_routes
node_auth_routes -->|"renders"| node_auth_pages
node_manager_routes -->|"renders"| node_manager_dashboard
node_manager_routes -->|"renders"| node_floor_mgmt
node_manager_routes -->|"renders"| node_menu_mgmt
node_manager_routes -->|"renders"| node_order_admin
node_staff_routes -->|"renders"| node_staff_ops
node_kitchen_routes -->|"renders"| node_kitchen_ops
node_auth_pages -->|"auth state"| node_redux_store
node_manager_dashboard -->|"reads"| node_redux_store
node_staff_ops -->|"reads"| node_redux_store
node_kitchen_ops -->|"reads"| node_redux_store
node_redux_store -->|"queries"| node_api_slices
node_redux_store -->|"models"| node_domain_types
node_domain_types -->|"normalizes"| node_runtime_utils
node_ui_kit -->|"builds on"| node_form_system
node_chrome -->|"composes"| node_ui_kit
node_chrome -->|"connects"| node_redux_store
node_runtime_utils -->|"supports"| node_redux_store
node_manager_dashboard -->|"live data"| node_runtime_utils
node_kitchen_ops -->|"live queue"| node_runtime_utils
node_staff_ops -->|"forms"| node_form_system
node_menu_mgmt -->|"forms"| node_form_system

click node_root_layout "https://github.com/arman-miaa/order-nest/blob/main/src/app/layout.tsx"
click node_default_layout "https://github.com/arman-miaa/order-nest/blob/main/src/app/(defaultLayout)/layout.tsx"
click node_dashboard_layout "https://github.com/arman-miaa/order-nest/blob/main/src/app/(dashboardLayout)/layout.tsx"
click node_auth_routes "https://github.com/arman-miaa/order-nest/tree/main/src/app/(auth)"
click node_manager_routes "https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/manager"
click node_staff_routes "https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/staff"
click node_kitchen_routes "https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/kitchen"
click node_auth_pages "https://github.com/arman-miaa/order-nest/tree/main/components/module/Auth"
click node_manager_dashboard "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/dashboard"
click node_floor_mgmt "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/floor-view"
click node_menu_mgmt "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/menu"
click node_order_admin "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/orders"
click node_staff_ops "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/staff"
click node_kitchen_ops "https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/kitchen"
click node_ui_kit "https://github.com/arman-miaa/order-nest/tree/main/components/ui"
click node_form_system "https://github.com/arman-miaa/order-nest/tree/main/components/form"
click node_chrome "https://github.com/arman-miaa/order-nest/tree/main/components/shared"
click node_redux_store "https://github.com/arman-miaa/order-nest/blob/main/redux/store.ts"
click node_api_slices "https://github.com/arman-miaa/order-nest/tree/main/redux/api"
click node_domain_types "https://github.com/arman-miaa/order-nest/blob/main/components/dashboard/shared/types/restaurant.types.ts"
click node_runtime_utils "https://github.com/arman-miaa/order-nest/tree/main/src/utils"

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_root_layout,node_default_layout,node_dashboard_layout,node_auth_routes,node_manager_routes,node_staff_routes,node_kitchen_routes toneBlue
class node_auth_pages,node_manager_dashboard,node_floor_mgmt,node_menu_mgmt,node_order_admin,node_staff_ops,node_kitchen_ops toneAmber
class node_redux_store,node_api_slices,node_domain_types,node_runtime_utils toneMint
class node_ui_kit,node_form_system,node_chrome toneRose
```

## Components

### App routes

Next.js App Router boundaries and route composition layers.

- [Root layout](https://github.com/arman-miaa/order-nest/blob/main/src/app/layout.tsx): next layout · Global app shell and providers entry point. · `src/app/layout.tsx`
- [Public layout](https://github.com/arman-miaa/order-nest/blob/main/src/app/(defaultLayout)/layout.tsx): route layout · Default public/home route group. · `src/app/(defaultLayout)/layout.tsx`
- [Dashboard layout](https://github.com/arman-miaa/order-nest/blob/main/src/app/(dashboardLayout)/layout.tsx): route layout · Authenticated dashboard route group shell. · `src/app/(dashboardLayout)/layout.tsx`
- [Auth routes](https://github.com/arman-miaa/order-nest/tree/main/src/app/(auth)): route group · Login, register, password reset, and OTP flows. · `src/app/(auth)`
- [Manager routes](https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/manager): route group · Manager dashboards for analytics, floor, menu, orders, settings, alerts, and users. · `src/app/(dashboardLayout)/manager`
- [Staff routes](https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/staff): route group · Staff workflows for new orders, service, tables, and fulfillment. · `src/app/(dashboardLayout)/staff`
- [Kitchen routes](https://github.com/arman-miaa/order-nest/tree/main/src/app/(dashboardLayout)/kitchen): route group · Kitchen views for queues, items, stations, and display pages. · `src/app/(dashboardLayout)/kitchen`

### Feature components

Role-based screens and domain workflows composed by routes.

- [Auth pages](https://github.com/arman-miaa/order-nest/tree/main/components/module/Auth): auth screens · Login, signup, forgot/reset password, OTP, and change-password screens. · `components/module/Auth`
- [Manager dashboard](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/dashboard): analytics view · Live stats, revenue, active orders, and breakdown panels. · `components/dashboard/manager/dashboard`
- [Floor management](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/floor-view): ops view · Table grid, floor map, and table detail interactions. · `components/dashboard/manager/floor-view`
- [Menu manager](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/menu): catalog admin · Menu and category administration with CRUD flows. · `components/dashboard/manager/menu`
- [Order admin](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/manager/orders): ops view · Active, VIP, and historical order oversight. · `components/dashboard/manager/orders`
- [Staff ops](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/staff): service workflow · Order capture, staff dashboard, tables, and ready-to-serve views. · `components/dashboard/staff`
- [Kitchen ops](https://github.com/arman-miaa/order-nest/tree/main/components/dashboard/kitchen): fulfillment workflow · Queue processing, item status, stations, and kitchen dashboard. · `components/dashboard/kitchen`

### State and data

Redux, RTK Query, auth, normalization, and real-time support.

- [Redux store](https://github.com/arman-miaa/order-nest/blob/main/redux/store.ts): client state · Global store, slices, provider, and RTK Query integration. · `redux/store.ts`
- [API slices](https://github.com/arman-miaa/order-nest/tree/main/redux/api): rtk query · Auth, events, members, notifications, restaurant, uploads, and users endpoints. · `redux/api`
- [Domain models](https://github.com/arman-miaa/order-nest/blob/main/components/dashboard/shared/types/restaurant.types.ts): shared types · Restaurant types and data normalization boundaries. · `components/dashboard/shared/types/restaurant.types.ts`
- [Runtime utils](https://github.com/arman-miaa/order-nest/tree/main/src/utils): support code · Socket, cookie, decoding, upload, and normalization helpers. · `src/utils`

### Shared foundation

Reusable UI primitives, forms, layout chrome, hooks, and utilities.

- [UI kit](https://github.com/arman-miaa/order-nest/tree/main/components/ui): design system · Shared primitives and higher-order UI components. · `components/ui`
- [Form system](https://github.com/arman-miaa/order-nest/tree/main/components/form): form layer · Reusable inputs, selects, date pickers, and form wrappers. · `components/form`
- [App chrome](https://github.com/arman-miaa/order-nest/tree/main/components/shared): layout chrome · Navbar, sidebar, footer, loading, banner, and role routing guard. · `components/shared`

## Connections

- Root layout → Public layout: wraps · Root layout delegates public routes to the default layout.
- Root layout → Dashboard layout: wraps · Root layout delegates authenticated areas to the dashboard layout.
- Root layout → Auth routes: hosts · Root app tree includes the auth route group.
- Public layout → App chrome: uses · Public pages share common navigation and footer chrome.
- Dashboard layout → Manager routes: hosts · Dashboard layout contains manager surfaces.
- Dashboard layout → Staff routes: hosts · Dashboard layout contains staff surfaces.
- Dashboard layout → Kitchen routes: hosts · Dashboard layout contains kitchen surfaces.
- Auth routes → Auth pages: renders · Auth route pages compose dedicated auth modules.
- Manager routes → Manager dashboard: renders · Manager dashboard route shells compose analytics views.
- Manager routes → Floor management: renders · Floor-view routes compose table management views.
- Manager routes → Menu manager: renders · Menu routes compose catalog admin views.
- Manager routes → Order admin: renders · Order routes compose manager oversight views.
- Staff routes → Staff ops: renders · Staff routes compose order taking and service workflows.
- Kitchen routes → Kitchen ops: renders · Kitchen routes compose queue and station workflows.
- Auth pages → Redux store: auth state · Auth flows rely on client state and session persistence.
- Manager dashboard → Redux store: reads · Dashboard widgets consume global state and RTK Query data.
- Staff ops → Redux store: reads · Staff workflows depend on shared client state and API data.
- Kitchen ops → Redux store: reads · Kitchen workflows depend on shared client state and API data.
- Redux store → API slices: queries · Store integrates RTK Query API slices.
- Redux store → Domain models: models · State and API payloads are normalized into restaurant models.
- Domain models → Runtime utils: normalizes · Utilities transform raw payloads into UI-friendly shapes.
- UI kit → Form system: builds on · Forms are assembled from shared UI primitives.
- App chrome → UI kit: composes · Shared navigation and layout pieces use the UI kit.
- App chrome → Redux store: connects · Role-based navigation and guards depend on auth/state.
- Runtime utils → Redux store: supports · Socket and data helpers feed the client data layer.
- Manager dashboard → Runtime utils: live data · Analytics and operational views consume live/normalized data.
- Kitchen ops → Runtime utils: live queue · Kitchen queue and alert views depend on near-real-time updates.
- Staff ops → Form system: forms · Order creation and service flows use standardized forms.
- Menu manager → Form system: forms · Menu administration uses reusable CRUD form controls.
