# rofiqulisalm/zm-factoryos architecture

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

- Interactive diagram: https://gitdiagram.com/rofiqulisalm/zm-factoryos
- Repository: https://github.com/rofiqulisalm/zm-factoryos

## Overview

FactoryOS is the main product: a factory-operations application with public pages, authentication, production/job-order screens, administration, and management dashboards. Users enter through its web app; authentication is handled by the API server, while the tree indicates broader factory routes and shared database/API packages. The mockup sandbox is a separate component-preview app. No README was provided, and most feature routes and dashboard data wiring were not sampled, so those connections are shown only where supported.

Main entry points: [`artifacts/zm-factoryos/src/App.tsx`](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/App.tsx) (FactoryOS app), [`artifacts/api-server/src/app.ts`](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/app.ts) (API application), [`artifacts/zm-factoryos/src/components/public/AuthPage.tsx`](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/public/AuthPage.tsx) (Sign-in and password), [`artifacts/api-server/src/routes/auth.ts`](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/routes/auth.ts) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_factory_ui["FactoryOS interface"]
  node_factory_app["FactoryOS app<br/>[App.tsx]"]
  node_public_pages["Public pages<br/>[LandingPage.tsx]"]
  node_auth_page["Sign-in and password<br/>[AuthPage.tsx]"]
  node_production["Production orders"]
  node_dashboard["Management dashboard"]
  node_admin["Section administration"]
end

subgraph group_server["API and identity"]
  node_api_app["API application<br/>[app.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.ts]"]
  node_auth_logic["Session and credentials<br/>[auth.ts]"]
  node_factory_routes["Factory routes<br/>[factory.ts]"]
end

subgraph group_shared["Shared packages"]
  node_db_package["Database access<br/>[index.ts]"]
  node_db_schema["Database schema<br/>[index.ts]"]
  node_api_client["React API client<br/>[index.ts]"]
end

subgraph group_sandbox["Mockup preview"]
  node_sandbox_app["Preview app<br/>[App.tsx]"]
end

node_user(("Factory staff"))

node_user -->|"uses"| node_factory_app
node_factory_app -->|"renders pages"| node_public_pages
node_factory_app -->|"routes to"| node_auth_page
node_factory_app -->|"routes to"| node_production
node_factory_app -->|"renders"| node_dashboard
node_factory_app -->|"routes to"| node_admin
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_factory_routes
node_auth_routes -->|"calls"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_db_package
node_db_package -->|"uses schema"| node_db_schema
node_auth_page -->|"uses query key"| node_api_client
node_user -->|"opens preview"| node_sandbox_app

click node_factory_app "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/App.tsx"
click node_public_pages "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/public/LandingPage.tsx"
click node_auth_page "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/public/AuthPage.tsx"
click node_production "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/production/AllFactoryOrdersPage.tsx"
click node_dashboard "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/dashboard/DashboardKpiCards.tsx"
click node_admin "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/admin/ManageSectionsPage.tsx"
click node_api_app "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/app.ts"
click node_auth_routes "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/routes/auth.ts"
click node_auth_logic "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/middlewares/auth.ts"
click node_factory_routes "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/routes/factory.ts"
click node_db_package "https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/db/src/index.ts"
click node_db_schema "https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/db/src/schema/index.ts"
click node_api_client "https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/api-client-react/src/index.ts"
click node_sandbox_app "https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/mockup-sandbox/src/App.tsx"

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_factory_app,node_public_pages,node_auth_page,node_production,node_dashboard,node_admin toneBlue
class node_api_app,node_auth_routes,node_auth_logic,node_factory_routes toneAmber
class node_db_package,node_db_schema,node_api_client toneMint
class node_sandbox_app toneRose
class node_user toneIndigo
```

## Components

### FactoryOS interface

- [FactoryOS app](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/App.tsx): `artifacts/zm-factoryos/src/App.tsx`
- [Public pages](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/public/LandingPage.tsx): `artifacts/zm-factoryos/src/components/public/LandingPage.tsx`
- [Sign-in and password](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/public/AuthPage.tsx): `artifacts/zm-factoryos/src/components/public/AuthPage.tsx`
- [Production orders](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/production/AllFactoryOrdersPage.tsx): `artifacts/zm-factoryos/src/components/production/AllFactoryOrdersPage.tsx`
- [Management dashboard](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/dashboard/DashboardKpiCards.tsx): `artifacts/zm-factoryos/src/components/dashboard/DashboardKpiCards.tsx`
- [Section administration](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/zm-factoryos/src/components/admin/ManageSectionsPage.tsx): `artifacts/zm-factoryos/src/components/admin/ManageSectionsPage.tsx`

### API and identity

- [API application](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/app.ts): `artifacts/api-server/src/app.ts`
- [Authentication routes](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/routes/auth.ts): `artifacts/api-server/src/routes/auth.ts`
- [Session and credentials](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/middlewares/auth.ts): `artifacts/api-server/src/middlewares/auth.ts`
- [Factory routes](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/api-server/src/routes/factory.ts): `artifacts/api-server/src/routes/factory.ts`

### Shared packages

- [Database access](https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/db/src/index.ts): `lib/db/src/index.ts`
- [Database schema](https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/db/src/schema/index.ts): `lib/db/src/schema/index.ts`
- [React API client](https://github.com/rofiqulisalm/zm-factoryos/blob/main/lib/api-client-react/src/index.ts): `lib/api-client-react/src/index.ts`

### Mockup preview

- [Preview app](https://github.com/rofiqulisalm/zm-factoryos/blob/main/artifacts/mockup-sandbox/src/App.tsx): `artifacts/mockup-sandbox/src/App.tsx`

### Other components

- **Factory staff**

## Connections

- Factory staff → FactoryOS app: uses
- FactoryOS app → Public pages: renders pages
- FactoryOS app → Sign-in and password: routes to
- FactoryOS app → Production orders: routes to
- FactoryOS app → Management dashboard: renders
- FactoryOS app → Section administration: routes to
- API application → Authentication routes: mounts
- API application → Factory routes: mounts
- Authentication routes → Session and credentials: calls
- Session and credentials → Database access: reads and writes
- Database access → Database schema: uses schema
- Sign-in and password → React API client: uses query key
- Factory staff → Preview app: opens preview
