# sohamsawalakhe/tailor-grid architecture

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

- Interactive diagram: https://gitdiagram.com/sohamsawalakhe/tailor-grid
- Repository: https://github.com/sohamsawalakhe/tailor-grid

## Overview

Darzi is a tailoring marketplace connecting customers who book garment services with partner studios that fulfill orders, alongside administrative operations. Customers browse services and locations, authenticate, place and track bookings; the backend provides service, identity, order, and studio APIs, with order dispatch coordinating nearby eligible studios. A separate studio portal supports partner onboarding and workbench tasks, while a customer-facing frontend provides booking and account experiences. The source excerpts establish backend routing and dispatch relationships; frontend-to-backend and several unsampled portal interactions are not directly evidenced, so those links are omitted.

Main entry points: [`backend/lib/prisma.js`](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/lib/prisma.js) (Prisma database access), [`backend/server.js`](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/server.js) (HTTP API server), [`backend/routes/orders.js`](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/orders.js) (Order lifecycle), [`studio/app`](https://github.com/sohamsawalakhe/tailor-grid/tree/main/studio/app) (Studio portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_customer_app["Customer app"]
  node_booking["Booking flow<br/>[page.tsx]"]
  node_customer_auth["Customer authentication<br/>[login-modal.tsx]"]
  node_customer_state["App state and types<br/>[data.ts]"]
  node_customer_api["Customer API client<br/>[api.ts]"]
end

subgraph group_backend["Marketplace backend"]
  node_backend_entry["HTTP API server<br/>[server.js]"]
  node_auth_routes["Identity routes<br/>[auth.js]"]
  node_service_routes["Services and studios<br/>[services.js]"]
  node_order_routes["Order lifecycle<br/>[orders.js]"]
  node_dispatch["Studio dispatch"]
  node_location["Studio location<br/>[locate.service.js]"]
  node_auth_middleware["Request authentication<br/>[auth-middleware.js]"]
  node_database_client["Prisma database access<br/>[prisma.js]"]
  node_database[("PostgreSQL")]
end

subgraph group_studio["Partner portal"]
  node_studio_app["Studio portal"]
  node_studio_onboarding["Partner onboarding<br/>[partner-flow.tsx]"]
  node_studio_workbench["Studio workbench"]
  node_studio_admin["Studio admin<br/>[page.tsx]"]
  node_studio_auth["Studio authentication<br/>[auth-modal.tsx]"]
  node_studio_api["Studio API client<br/>[api.ts]"]
end

subgraph group_operations["Platform operations"]
  node_admin_routes["Platform administration<br/>[admin.js]"]
end

node_customer_actor(("Customer"))
node_studio_actor(("Studio partner"))
node_admin_actor(("Platform administrator"))

node_customer_actor -->|"uses"| node_customer_app
node_customer_app -->|"opens booking"| node_booking
node_customer_app -->|"authenticates with"| node_customer_auth
node_booking -.->|"uses types"| node_customer_state
node_customer_auth -.->|"calls"| node_customer_api
node_backend_entry -->|"mounts routes"| node_auth_routes
node_backend_entry -->|"mounts routes"| node_service_routes
node_backend_entry -->|"mounts routes"| node_order_routes
node_backend_entry -->|"mounts routes"| node_admin_routes
node_backend_entry -->|"checks connection"| node_database_client
node_service_routes -->|"locates studios"| node_location
node_order_routes -->|"dispatches orders"| node_dispatch
node_dispatch -->|"calculates distance"| node_location
node_dispatch -->|"reads and updates"| node_database_client
node_service_routes -->|"reads and writes"| node_database_client
node_auth_routes -->|"reads and writes"| node_database_client
node_order_routes -->|"reads and writes"| node_database_client
node_database_client -->|"queries"| node_database
node_order_routes -->|"authenticates requests"| node_auth_middleware
node_studio_actor -->|"uses"| node_studio_app
node_studio_app -.->|"onboards through"| node_studio_onboarding
node_studio_app -.->|"manages work in"| node_studio_workbench
node_studio_app -.->|"signs in through"| node_studio_auth
node_studio_auth -->|"calls"| node_studio_api
node_admin_actor -.->|"administers through"| node_admin_routes
node_admin_routes -->|"reads and writes"| node_database_client

click node_customer_app "https://github.com/sohamsawalakhe/tailor-grid/tree/main/frontend/app"
click node_booking "https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/app/(customer)/book/page.tsx"
click node_customer_auth "https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/components/login-modal.tsx"
click node_customer_state "https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/components/data.ts"
click node_customer_api "https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/lib/api.ts"
click node_backend_entry "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/server.js"
click node_auth_routes "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/auth.js"
click node_service_routes "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/services.js"
click node_order_routes "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/orders.js"
click node_dispatch "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/services/dispatch.service.js"
click node_location "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/services/locate.service.js"
click node_auth_middleware "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/lib/auth-middleware.js"
click node_database_client "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/lib/prisma.js"
click node_studio_app "https://github.com/sohamsawalakhe/tailor-grid/tree/main/studio/app"
click node_studio_onboarding "https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/components/partner-flow.tsx"
click node_studio_workbench "https://github.com/sohamsawalakhe/tailor-grid/tree/main/studio/app/(workbench)"
click node_studio_admin "https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/app/admin/page.tsx"
click node_studio_auth "https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/components/auth-modal.tsx"
click node_studio_api "https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/lib/api.ts"
click node_admin_routes "https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/admin.js"

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_customer_app,node_booking,node_customer_auth,node_customer_state,node_customer_api toneBlue
class node_backend_entry,node_auth_routes,node_service_routes,node_order_routes,node_dispatch,node_location,node_auth_middleware,node_database_client,node_database toneAmber
class node_studio_app,node_studio_onboarding,node_studio_workbench,node_studio_admin,node_studio_auth,node_studio_api toneMint
class node_admin_routes toneRose
class node_customer_actor,node_studio_actor,node_admin_actor toneIndigo
```

## Components

### Customer experience

- [Customer app](https://github.com/sohamsawalakhe/tailor-grid/tree/main/frontend/app): `frontend/app`
- [Booking flow](https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/app/(customer)/book/page.tsx): `frontend/app/(customer)/book/page.tsx`
- [Customer authentication](https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/components/login-modal.tsx): `frontend/components/login-modal.tsx`
- [App state and types](https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/components/data.ts): `frontend/components/data.ts`
- [Customer API client](https://github.com/sohamsawalakhe/tailor-grid/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### Marketplace backend

- [HTTP API server](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/server.js): `backend/server.js`
- [Identity routes](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Services and studios](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/services.js): `backend/routes/services.js`
- [Order lifecycle](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/orders.js): `backend/routes/orders.js`
- [Studio dispatch](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/services/dispatch.service.js): `backend/services/dispatch.service.js`
- [Studio location](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/services/locate.service.js): `backend/services/locate.service.js`
- [Request authentication](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/lib/auth-middleware.js): `backend/lib/auth-middleware.js`
- [Prisma database access](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/lib/prisma.js): `backend/lib/prisma.js`
- **PostgreSQL**

### Partner portal

- [Studio portal](https://github.com/sohamsawalakhe/tailor-grid/tree/main/studio/app): `studio/app`
- [Partner onboarding](https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/components/partner-flow.tsx): `studio/components/partner-flow.tsx`
- [Studio workbench](https://github.com/sohamsawalakhe/tailor-grid/tree/main/studio/app/(workbench)): `studio/app/(workbench)`
- [Studio admin](https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/app/admin/page.tsx): `studio/app/admin/page.tsx`
- [Studio authentication](https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/components/auth-modal.tsx): `studio/components/auth-modal.tsx`
- [Studio API client](https://github.com/sohamsawalakhe/tailor-grid/blob/main/studio/lib/api.ts): `studio/lib/api.ts`

### Platform operations

- [Platform administration](https://github.com/sohamsawalakhe/tailor-grid/blob/main/backend/routes/admin.js): `backend/routes/admin.js`

### Other components

- **Customer**
- **Studio partner**
- **Platform administrator**

## Connections

- Customer → Customer app: uses
- Customer app → Booking flow: opens booking
- Customer app → Customer authentication: authenticates with
- Booking flow → App state and types: uses types
- Customer authentication → Customer API client: calls
- HTTP API server → Identity routes: mounts routes (evidence: `backend/server.js`)
- HTTP API server → Services and studios: mounts routes (evidence: `backend/server.js`)
- HTTP API server → Order lifecycle: mounts routes (evidence: `backend/server.js`)
- HTTP API server → Platform administration: mounts routes (evidence: `backend/server.js`)
- HTTP API server → Prisma database access: checks connection (evidence: `backend/server.js`)
- Services and studios → Studio location: locates studios (evidence: `backend/routes/services.js`)
- Order lifecycle → Studio dispatch: dispatches orders (evidence: `backend/routes/orders.js`)
- Studio dispatch → Studio location: calculates distance (evidence: `backend/services/dispatch.service.js`)
- Studio dispatch → Prisma database access: reads and updates (evidence: `backend/services/dispatch.service.js`)
- Services and studios → Prisma database access: reads and writes (evidence: `backend/routes/services.js`)
- Identity routes → Prisma database access: reads and writes (evidence: `backend/routes/auth.js`)
- Order lifecycle → Prisma database access: reads and writes (evidence: `backend/routes/orders.js`)
- Prisma database access → PostgreSQL: queries (evidence: `backend/lib/prisma.js`)
- Order lifecycle → Request authentication: authenticates requests (evidence: `backend/routes/orders.js`)
- Studio partner → Studio portal: uses
- Studio portal → Partner onboarding: onboards through
- Studio portal → Studio workbench: manages work in
- Studio portal → Studio authentication: signs in through
- Studio authentication → Studio API client: calls (evidence: `studio/components/auth-modal.tsx`)
- Platform administrator → Platform administration: administers through
- Platform administration → Prisma database access: reads and writes (evidence: `backend/routes/admin.js`)
