# openshiporg/openship architecture

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

- Interactive diagram: https://gitdiagram.com/openshiporg/openship
- Repository: https://github.com/openshiporg/openship

## Overview

Openship is an order-routing platform: operators connect sales shops to fulfillment channels, configure links and product matches, then manage orders through routing and fulfillment. The graph highlights that workflow, its Keystone/GraphQL domain layer, external shop and channel integrations, and the admin dashboard. README capabilities such as Shopify connectors, webhooks, tracking, and API keys are retained where paths support them. Evidence is limited to the provided excerpts and README; unverified wiring is omitted.

Main entry points: [`features/keystone/extendGraphqlSchema`](https://github.com/openshiporg/openship/tree/main/features/keystone/extendGraphqlSchema) (GraphQL schema), [`features/platform/orders/screens/OrderListPageClient.tsx`](https://github.com/openshiporg/openship/blob/main/features/platform/orders/screens/OrderListPageClient.tsx) (Order management), [`features/keystone/index.ts`](https://github.com/openshiporg/openship/blob/main/features/keystone/index.ts) (Keystone runtime), [`features/integrations/shop/lib/executor.ts`](https://github.com/openshiporg/openship/blob/main/features/integrations/shop/lib/executor.ts) (Shop connector executor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ops["Order operations"]
  node_orders_ui["Order management"]
  node_matches_ui["Product matching"]
  node_shop_admin["Shop configuration"]
  node_channel_admin["Channel configuration"]
  node_api_keys["API key management"]
end

subgraph group_backend["Domain backend"]
  node_graphql["GraphQL schema"]
  node_models[("Commerce models")]
  node_keystone["Keystone runtime<br/>[index.ts]"]
  node_db_context["Database context<br/>[context.ts]"]
end

subgraph group_connectors["Commerce integrations"]
  node_shop_exec["Shop connector executor<br/>[executor.ts]"]
  node_channel_exec["Channel connector executor<br/>[executor.ts]"]
  node_shopify_shop["Shopify shop adapter<br/>[shopify.ts]"]
  node_openfront_shop["Openfront shop adapter<br/>[openfront.ts]"]
  node_shop_webhooks["Shop webhook handlers<br/>[route.ts]"]
  node_channel_webhooks["Channel webhook handlers<br/>[route.ts]"]
  node_tracking["Tracking relays<br/>[tracking-relay.ts]"]
  node_oauth["OAuth callback<br/>[route.ts]"]
end

subgraph group_dashboard["Admin dashboard"]
  node_dashboard["Dashboard data access<br/>[useQueryFactory.ts]"]
  node_filtering["List filtering"]
  node_edit_item["Record editing"]
end

subgraph group_ai["AI tools"]
  node_completion["AI completion API<br/>[route.ts]"]
  node_mcp["MCP transport<br/>[route.ts]"]
end

node_operator(("Platform operator"))
node_shop{{"Sales shop"}}
node_channel{{"Fulfillment channel"}}
node_ai_integration{{"AI provider"}}
node_postgres[("PostgreSQL")]

node_operator -.->|"configures shops"| node_shop_admin
node_operator -.->|"configures channels"| node_channel_admin
node_operator -.->|"maps products"| node_matches_ui
node_operator -->|"manages orders"| node_orders_ui
node_orders_ui -.->|"runs order actions"| node_graphql
node_matches_ui -.->|"manages matches"| node_graphql
node_shop_admin -.->|"configures shops"| node_graphql
node_channel_admin -.->|"configures channels"| node_graphql
node_api_keys -.->|"manages keys"| node_graphql
node_orders_ui -->|"searches shop orders"| node_shop_admin
node_orders_ui -->|"places orders"| node_orders_ui
node_dashboard -.->|"builds filters"| node_filtering
node_edit_item -->|"updates records"| node_dashboard
node_keystone -->|"registers models"| node_models
node_keystone -->|"extends schema"| node_graphql
node_db_context -->|"loads config"| node_keystone
node_keystone -.->|"persists data"| node_postgres
node_shop -.->|"sends order events"| node_shop_webhooks
node_shop_webhooks -->|"dispatches shop work"| node_shop_exec
node_shop_exec -.->|"supports adapter"| node_shopify_shop
node_shop_exec -.->|"supports adapter"| node_openfront_shop
node_channel -.->|"sends tracking"| node_channel_webhooks
node_channel_webhooks -->|"dispatches channel work"| node_channel_exec
node_channel_webhooks -->|"relays tracking"| node_tracking
node_oauth -->|"handles shop OAuth"| node_shop_exec
node_oauth -->|"handles channel OAuth"| node_channel_exec
node_operator -.->|"asks assistant"| node_completion
node_completion -->|"connects tools"| node_mcp
node_completion -.->|"streams response"| node_ai_integration

click node_orders_ui "https://github.com/openshiporg/openship/blob/main/features/platform/orders/screens/OrderListPageClient.tsx"
click node_matches_ui "https://github.com/openshiporg/openship/blob/main/features/platform/matches/screens/MatchesListPageClient.tsx"
click node_shop_admin "https://github.com/openshiporg/openship/tree/main/features/platform/shops"
click node_channel_admin "https://github.com/openshiporg/openship/tree/main/features/platform/channels"
click node_api_keys "https://github.com/openshiporg/openship/tree/main/features/platform/api-keys"
click node_graphql "https://github.com/openshiporg/openship/tree/main/features/keystone/extendGraphqlSchema"
click node_models "https://github.com/openshiporg/openship/tree/main/features/keystone/models"
click node_keystone "https://github.com/openshiporg/openship/blob/main/features/keystone/index.ts"
click node_db_context "https://github.com/openshiporg/openship/blob/main/features/keystone/context.ts"
click node_shop_exec "https://github.com/openshiporg/openship/blob/main/features/integrations/shop/lib/executor.ts"
click node_channel_exec "https://github.com/openshiporg/openship/blob/main/features/integrations/channel/lib/executor.ts"
click node_shopify_shop "https://github.com/openshiporg/openship/blob/main/features/integrations/shop/shopify.ts"
click node_openfront_shop "https://github.com/openshiporg/openship/blob/main/features/integrations/shop/openfront.ts"
click node_shop_webhooks "https://github.com/openshiporg/openship/blob/main/app/api/handlers/shop/create-order/%5BshopId%5D/route.ts"
click node_channel_webhooks "https://github.com/openshiporg/openship/blob/main/app/api/handlers/channel/create-tracking/%5BchannelId%5D/route.ts"
click node_tracking "https://github.com/openshiporg/openship/blob/main/features/integrations/channel/tracking-relay.ts"
click node_oauth "https://github.com/openshiporg/openship/blob/main/app/api/oauth/callback/route.ts"
click node_dashboard "https://github.com/openshiporg/openship/blob/main/features/dashboard/hooks/useQueryFactory.ts"
click node_filtering "https://github.com/openshiporg/openship/blob/main/features/dashboard/lib/buildWhereClause.ts"
click node_edit_item "https://github.com/openshiporg/openship/blob/main/features/platform/components/EditItemDrawerClient.tsx"
click node_completion "https://github.com/openshiporg/openship/blob/main/app/api/completion/route.ts"
click node_mcp "https://github.com/openshiporg/openship/blob/main/app/api/mcp-transport/%5Btransport%5D/route.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_orders_ui,node_matches_ui,node_shop_admin,node_channel_admin,node_api_keys toneBlue
class node_graphql,node_models,node_keystone,node_db_context,node_postgres toneAmber
class node_shop_exec,node_channel_exec,node_shopify_shop,node_openfront_shop,node_shop_webhooks,node_channel_webhooks,node_tracking,node_oauth toneMint
class node_dashboard,node_filtering,node_edit_item toneRose
class node_completion,node_mcp,node_operator,node_shop,node_channel,node_ai_integration toneIndigo
```

## Components

### Order operations

- [Order management](https://github.com/openshiporg/openship/blob/main/features/platform/orders/screens/OrderListPageClient.tsx): `features/platform/orders/screens/OrderListPageClient.tsx`
- [Product matching](https://github.com/openshiporg/openship/blob/main/features/platform/matches/screens/MatchesListPageClient.tsx): `features/platform/matches/screens/MatchesListPageClient.tsx`
- [Shop configuration](https://github.com/openshiporg/openship/tree/main/features/platform/shops): `features/platform/shops`
- [Channel configuration](https://github.com/openshiporg/openship/tree/main/features/platform/channels): `features/platform/channels`
- [API key management](https://github.com/openshiporg/openship/tree/main/features/platform/api-keys): `features/platform/api-keys`

### Domain backend

- [GraphQL schema](https://github.com/openshiporg/openship/tree/main/features/keystone/extendGraphqlSchema): `features/keystone/extendGraphqlSchema`
- [Commerce models](https://github.com/openshiporg/openship/tree/main/features/keystone/models): `features/keystone/models`
- [Keystone runtime](https://github.com/openshiporg/openship/blob/main/features/keystone/index.ts): `features/keystone/index.ts`
- [Database context](https://github.com/openshiporg/openship/blob/main/features/keystone/context.ts): `features/keystone/context.ts`

### Commerce integrations

- [Shop connector executor](https://github.com/openshiporg/openship/blob/main/features/integrations/shop/lib/executor.ts): `features/integrations/shop/lib/executor.ts`
- [Channel connector executor](https://github.com/openshiporg/openship/blob/main/features/integrations/channel/lib/executor.ts): `features/integrations/channel/lib/executor.ts`
- [Shopify shop adapter](https://github.com/openshiporg/openship/blob/main/features/integrations/shop/shopify.ts): `features/integrations/shop/shopify.ts`
- [Openfront shop adapter](https://github.com/openshiporg/openship/blob/main/features/integrations/shop/openfront.ts): `features/integrations/shop/openfront.ts`
- [Shop webhook handlers](https://github.com/openshiporg/openship/blob/main/app/api/handlers/shop/create-order/%5BshopId%5D/route.ts): `app/api/handlers/shop/create-order/[shopId]/route.ts`
- [Channel webhook handlers](https://github.com/openshiporg/openship/blob/main/app/api/handlers/channel/create-tracking/%5BchannelId%5D/route.ts): `app/api/handlers/channel/create-tracking/[channelId]/route.ts`
- [Tracking relays](https://github.com/openshiporg/openship/blob/main/features/integrations/channel/tracking-relay.ts): `features/integrations/channel/tracking-relay.ts`
- [OAuth callback](https://github.com/openshiporg/openship/blob/main/app/api/oauth/callback/route.ts): `app/api/oauth/callback/route.ts`

### Admin dashboard

- [Dashboard data access](https://github.com/openshiporg/openship/blob/main/features/dashboard/hooks/useQueryFactory.ts): `features/dashboard/hooks/useQueryFactory.ts`
- [List filtering](https://github.com/openshiporg/openship/blob/main/features/dashboard/lib/buildWhereClause.ts): `features/dashboard/lib/buildWhereClause.ts`
- [Record editing](https://github.com/openshiporg/openship/blob/main/features/platform/components/EditItemDrawerClient.tsx): `features/platform/components/EditItemDrawerClient.tsx`

### AI tools

- [AI completion API](https://github.com/openshiporg/openship/blob/main/app/api/completion/route.ts): `app/api/completion/route.ts`
- [MCP transport](https://github.com/openshiporg/openship/blob/main/app/api/mcp-transport/%5Btransport%5D/route.ts): `app/api/mcp-transport/[transport]/route.ts`

### Other components

- **Platform operator**
- **Sales shop**
- **Fulfillment channel**
- **AI provider**
- **PostgreSQL**

## Connections

- Platform operator → Shop configuration: configures shops
- Platform operator → Channel configuration: configures channels
- Platform operator → Product matching: maps products
- Platform operator → Order management: manages orders (evidence: `features/platform/orders/screens/OrderListPageClient.tsx`)
- Order management → GraphQL schema: runs order actions
- Product matching → GraphQL schema: manages matches
- Shop configuration → GraphQL schema: configures shops
- Channel configuration → GraphQL schema: configures channels
- API key management → GraphQL schema: manages keys
- Order management → Shop configuration: searches shop orders (evidence: `features/platform/orders/screens/OrderListPageClient.tsx`)
- Order management → Order management: places orders (evidence: `features/platform/orders/screens/OrderListPageClient.tsx`)
- Dashboard data access → List filtering: builds filters
- Record editing → Dashboard data access: updates records (evidence: `features/platform/components/EditItemDrawerClient.tsx`)
- Keystone runtime → Commerce models: registers models (evidence: `features/keystone/index.ts`)
- Keystone runtime → GraphQL schema: extends schema (evidence: `features/keystone/index.ts`)
- Database context → Keystone runtime: loads config (evidence: `features/keystone/context.ts`)
- Keystone runtime → PostgreSQL: persists data
- Sales shop → Shop webhook handlers: sends order events
- Shop webhook handlers → Shop connector executor: dispatches shop work (evidence: `app/api/handlers/shop/create-order/[shopId]/route.ts`)
- Shop connector executor → Shopify shop adapter: supports adapter
- Shop connector executor → Openfront shop adapter: supports adapter
- Fulfillment channel → Channel webhook handlers: sends tracking
- Channel webhook handlers → Channel connector executor: dispatches channel work (evidence: `app/api/handlers/channel/create-tracking/[channelId]/route.ts`)
- Channel webhook handlers → Tracking relays: relays tracking (evidence: `app/api/handlers/channel/create-tracking/[channelId]/route.ts`)
- OAuth callback → Shop connector executor: handles shop OAuth (evidence: `app/api/oauth/callback/route.ts`)
- OAuth callback → Channel connector executor: handles channel OAuth (evidence: `app/api/oauth/callback/route.ts`)
- Platform operator → AI completion API: asks assistant
- AI completion API → MCP transport: connects tools (evidence: `app/api/completion/route.ts`)
- AI completion API → AI provider: streams response
