# innocentqqq/forge-backend architecture

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

- Interactive diagram: https://gitdiagram.com/innocentqqq/forge-backend
- Repository: https://github.com/innocentqqq/forge-backend

## Overview

Forge is a 3D-printing marketplace with a mobile customer app, provider dashboard, and API. Customers discover printers and models, submit print settings and an order, then track its status; providers onboard, manage printer/provider details, and update orders. The API also supports profiles, saved providers, authentication checks, and pricing. Edges reflect README capabilities and sampled calls; some route wiring and persistence beyond shown excerpts are documented or unsampled, so those links are omitted or marked unverified.

Main entry points: [`apps/mobile/lib/api.ts`](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/api.ts) (API client), [`apps/api/src/app.ts`](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/app.ts) (API application), [`apps/api/src/config/supabase.ts`](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/config/supabase.ts) (Supabase data), [`apps/mobile/app`](https://github.com/innocentqqq/forge-backend/tree/master/apps/mobile/app) (Marketplace screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_mobile_screens["Marketplace screens"]
  node_auth_screens["Sign-in screens"]
  node_provider_screens["Provider dashboard<br/>[provider.tsx]"]
  node_order_detail["Order detail<br/>[&#91;id&#93;.tsx]"]
  node_provider_order_detail["Provider order<br/>[&#91;id&#93;.tsx]"]
  node_mobile_api["API client<br/>[api.ts]"]
  node_auth_client["Auth client<br/>[auth.tsx]"]
  node_oauth["OAuth flow<br/>[oauth.ts]"]
  node_ui["UI components<br/>[ui.tsx]"]
end

subgraph group_api["API and identity"]
  node_api_app["API application<br/>[app.ts]"]
  node_api_auth["Authentication<br/>[auth.ts]"]
  node_oauth_check["OAuth account check<br/>[auth.controller.ts]"]
  node_database[("Supabase data<br/>[supabase.ts]")]
end

subgraph group_market["Marketplace operations"]
  node_model_processing["Model processing"]
  node_printer_catalog["Printer catalog"]
  node_orders["Order lifecycle"]
  node_pricing["Print pricing<br/>[pricing.service.ts]"]
  node_profiles["Profiles<br/>[profile.service.ts]"]
  node_providers["Provider management"]
end

subgraph group_contracts["Shared contract"]
  node_shared_types["API contract types<br/>[index.ts]"]
end

node_customer(("Customer"))
node_provider_user(("Print provider"))
node_supabase_auth["Supabase Auth"]

node_customer -->|"uses"| node_mobile_screens
node_provider_user -->|"uses"| node_provider_screens
node_mobile_screens -->|"requests"| node_mobile_api
node_mobile_screens -->|"renders"| node_ui
node_auth_screens -.->|"authenticates"| node_auth_client
node_auth_client -->|"delegates to"| node_oauth
node_oauth -->|"checks account"| node_mobile_api
node_order_detail -->|"requests"| node_mobile_api
node_provider_order_detail -->|"requests"| node_mobile_api
node_provider_screens -.->|"requests"| node_mobile_api
node_mobile_api -->|"HTTP requests"| node_api_app
node_mobile_api -->|"uses types"| node_shared_types
node_api_app -.->|"registers middleware"| node_api_auth
node_api_app -.->|"routes requests"| node_orders
node_api_app -.->|"routes requests"| node_printer_catalog
node_api_app -.->|"routes requests"| node_model_processing
node_orders -->|"estimates price"| node_pricing
node_orders -->|"reads and writes"| node_database
node_providers -->|"reads and writes"| node_database
node_profiles -.->|"reads and writes"| node_database
node_api_auth -->|"validates token"| node_database
node_oauth_check -->|"checks or deletes"| node_supabase_auth
node_oauth_check -->|"gets user"| node_api_auth
node_providers -.->|"uses contract"| node_shared_types

click node_mobile_screens "https://github.com/innocentqqq/forge-backend/tree/master/apps/mobile/app"
click node_auth_screens "https://github.com/innocentqqq/forge-backend/tree/master/apps/mobile/app/(auth)"
click node_provider_screens "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/(tabs)/provider.tsx"
click node_order_detail "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/order/%5Bid%5D.tsx"
click node_provider_order_detail "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/provider-order/%5Bid%5D.tsx"
click node_mobile_api "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/api.ts"
click node_auth_client "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/auth.tsx"
click node_oauth "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/oauth.ts"
click node_ui "https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/components/ui.tsx"
click node_api_app "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/app.ts"
click node_api_auth "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/middleware/auth.ts"
click node_oauth_check "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/auth/auth.controller.ts"
click node_model_processing "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/models/models.controller.ts"
click node_printer_catalog "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/printers/printers.controller.ts"
click node_orders "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/orders/orders.controller.ts"
click node_pricing "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/pricing/pricing.service.ts"
click node_profiles "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/profile/profile.service.ts"
click node_providers "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/providers/providers.service.ts"
click node_database "https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/config/supabase.ts"
click node_shared_types "https://github.com/innocentqqq/forge-backend/blob/master/packages/types/src/index.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_mobile_screens,node_auth_screens,node_provider_screens,node_order_detail,node_provider_order_detail,node_mobile_api,node_auth_client,node_oauth,node_ui toneBlue
class node_api_app,node_api_auth,node_oauth_check,node_database toneAmber
class node_model_processing,node_printer_catalog,node_orders,node_pricing,node_profiles,node_providers toneMint
class node_shared_types toneRose
class node_customer,node_provider_user,node_supabase_auth toneIndigo
```

## Components

### Mobile app

- [Marketplace screens](https://github.com/innocentqqq/forge-backend/tree/master/apps/mobile/app): `apps/mobile/app`
- [Sign-in screens](https://github.com/innocentqqq/forge-backend/tree/master/apps/mobile/app/(auth)): `apps/mobile/app/(auth)`
- [Provider dashboard](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/(tabs)/provider.tsx): `apps/mobile/app/(tabs)/provider.tsx`
- [Order detail](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/order/%5Bid%5D.tsx): `apps/mobile/app/order/[id].tsx`
- [Provider order](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/app/provider-order/%5Bid%5D.tsx): `apps/mobile/app/provider-order/[id].tsx`
- [API client](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/api.ts): `apps/mobile/lib/api.ts`
- [Auth client](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/auth.tsx): `apps/mobile/lib/auth.tsx`
- [OAuth flow](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/lib/oauth.ts): `apps/mobile/lib/oauth.ts`
- [UI components](https://github.com/innocentqqq/forge-backend/blob/master/apps/mobile/components/ui.tsx): `apps/mobile/components/ui.tsx`

### API and identity

- [API application](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/app.ts): `apps/api/src/app.ts`
- [Authentication](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/middleware/auth.ts): `apps/api/src/middleware/auth.ts`
- [OAuth account check](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/auth/auth.controller.ts): `apps/api/src/modules/auth/auth.controller.ts`
- [Supabase data](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/config/supabase.ts): `apps/api/src/config/supabase.ts`

### Marketplace operations

- [Model processing](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/models/models.controller.ts): `apps/api/src/modules/models/models.controller.ts`
- [Printer catalog](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/printers/printers.controller.ts): `apps/api/src/modules/printers/printers.controller.ts`
- [Order lifecycle](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/orders/orders.controller.ts): `apps/api/src/modules/orders/orders.controller.ts`
- [Print pricing](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/pricing/pricing.service.ts): `apps/api/src/modules/pricing/pricing.service.ts`
- [Profiles](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/profile/profile.service.ts): `apps/api/src/modules/profile/profile.service.ts`
- [Provider management](https://github.com/innocentqqq/forge-backend/blob/master/apps/api/src/modules/providers/providers.service.ts): `apps/api/src/modules/providers/providers.service.ts`

### Shared contract

- [API contract types](https://github.com/innocentqqq/forge-backend/blob/master/packages/types/src/index.ts): `packages/types/src/index.ts`

### Other components

- **Customer**
- **Print provider**
- **Supabase Auth**

## Connections

- Customer → Marketplace screens: uses
- Print provider → Provider dashboard: uses
- Marketplace screens → API client: requests (evidence: `apps/mobile/app/(tabs)/index.tsx`)
- Marketplace screens → UI components: renders (evidence: `apps/mobile/app/(tabs)/index.tsx`)
- Sign-in screens → Auth client: authenticates
- Auth client → OAuth flow: delegates to (evidence: `apps/mobile/lib/auth.tsx`)
- OAuth flow → API client: checks account (evidence: `apps/mobile/lib/oauth.ts`)
- Order detail → API client: requests (evidence: `apps/mobile/app/order/[id].tsx`)
- Provider order → API client: requests (evidence: `apps/mobile/app/provider-order/[id].tsx`)
- Provider dashboard → API client: requests
- API client → API application: HTTP requests (evidence: `apps/mobile/lib/api.ts`)
- API client → API contract types: uses types
- API application → Authentication: registers middleware
- API application → Order lifecycle: routes requests
- API application → Printer catalog: routes requests
- API application → Model processing: routes requests
- Order lifecycle → Print pricing: estimates price (evidence: `apps/api/src/modules/orders/orders.controller.ts`)
- Order lifecycle → Supabase data: reads and writes (evidence: `apps/api/src/modules/orders/orders.controller.ts`)
- Provider management → Supabase data: reads and writes (evidence: `apps/api/src/modules/providers/providers.service.ts`)
- Profiles → Supabase data: reads and writes (evidence: `apps/api/src/modules/profile/profile.service.ts`)
- Authentication → Supabase data: validates token (evidence: `apps/api/src/middleware/auth.ts`)
- OAuth account check → Supabase Auth: checks or deletes (evidence: `apps/api/src/modules/auth/auth.controller.ts`)
- OAuth account check → Authentication: gets user (evidence: `apps/api/src/modules/auth/auth.controller.ts`)
- Provider management → API contract types: uses contract
