# comstrx/saasx architecture

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

- Interactive diagram: https://gitdiagram.com/comstrx/saasx
- Repository: https://github.com/comstrx/saasx

## Overview

SaasX is a multi-tenant SaaS composed of two shared foundations and five product parts. The principal customer flow is through the mobile or web experience into backend services for identity, tenant access, and business operations; the README describes the product capabilities, but the sampled source does not expose most backend or mobile call chains. The graph therefore uses documented relationships and keeps other products—especially infrastructure and the MCP knowledge runtime—as distinct branches. Subsystem paths identify unsampled areas; sampled web API internals are shown where they clarify the request layer.

Main entry points: [`platform/mobile/src/app`](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/app) (Multi-role mobile app), [`platform/web`](https://github.com/comstrx/saasx/tree/main/platform/web) (Web surfaces), [`platform/api/crates`](https://github.com/comstrx/saasx/tree/main/platform/api/crates) (SaaS API services), [`platform/web/src/api/core/client.ts`](https://github.com/comstrx/saasx/blob/main/platform/web/src/api/core/client.ts) (Web API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["Shared foundations"]
  node_rust["Rust foundation<br/>[lib.rs]"]
  node_node["TypeScript foundation<br/>[index.ts]"]
end

subgraph group_services["Backend services"]
  node_api["SaaS API services"]
  node_api_contracts["API contracts"]
end

subgraph group_experiences["Customer experiences"]
  node_web["Web surfaces"]
  node_web_specs["Web specs"]
  node_web_api["Web API client<br/>[client.ts]"]
  node_web_workflow["Server API workflow<br/>[server.ts]"]
  node_web_routes["Route and query utilities<br/>[route.ts]"]
  node_web_reviews["Review management<br/>[review-manager.tsx]"]
  node_mobile["Multi-role mobile app"]
  node_mobile_api["Mobile API client<br/>[client.ts]"]
  node_mobile_auth["Mobile identity flows"]
  node_mobile_catalog["Catalog and discovery"]
  node_mobile_checkout["Cart and checkout"]
  node_mobile_orders["Orders and tickets"]
end

subgraph group_operations["Platform operations"]
  node_infra["Infrastructure engine<br/>[main.rs]"]
end

subgraph group_knowledge["Knowledge runtime"]
  node_skill["MCP knowledge runtime<br/>[main.rs]"]
end

node_user(("Customer or staff"))
node_agent(("AI agent"))

node_user -->|"uses app"| node_mobile
node_user -->|"uses surfaces"| node_web
node_mobile -->|"supports identity"| node_mobile_auth
node_mobile -->|"supports discovery"| node_mobile_catalog
node_mobile -->|"supports checkout"| node_mobile_checkout
node_mobile -->|"supports orders"| node_mobile_orders
node_mobile -.->|"uses API client"| node_mobile_api
node_mobile_api -.->|"calls services"| node_api
node_web -->|"declares surfaces"| node_web_specs
node_web -.->|"loads server data"| node_web_workflow
node_web_workflow -->|"uses client"| node_web_api
node_web_api -->|"encodes requests"| node_web_routes
node_web_api -.->|"calls services"| node_api
node_web -.->|"manages reviews"| node_web_reviews
node_web_reviews -.->|"persists review actions"| node_api
node_api -->|"exposes contracts"| node_api_contracts
node_api -->|"builds on"| node_rust
node_web -->|"builds on"| node_node
node_mobile -->|"builds on"| node_node
node_infra -->|"builds on"| node_rust
node_agent -->|"queries MCP"| node_skill
node_skill -.->|"builds on"| node_rust

click node_rust "https://github.com/comstrx/saasx/blob/main/engine/rust/crates/base/src/lib.rs"
click node_node "https://github.com/comstrx/saasx/blob/main/engine/node/packages/base/src/index.ts"
click node_api "https://github.com/comstrx/saasx/tree/main/platform/api/crates"
click node_api_contracts "https://github.com/comstrx/saasx/tree/main/platform/api"
click node_web "https://github.com/comstrx/saasx/tree/main/platform/web"
click node_web_specs "https://github.com/comstrx/saasx/tree/main/platform/web/specs"
click node_web_api "https://github.com/comstrx/saasx/blob/main/platform/web/src/api/core/client.ts"
click node_web_workflow "https://github.com/comstrx/saasx/blob/main/platform/web/src/api/workflow/server.ts"
click node_web_routes "https://github.com/comstrx/saasx/blob/main/platform/web/src/lib/std/route.ts"
click node_web_reviews "https://github.com/comstrx/saasx/blob/main/platform/web/src/components/review-manager.tsx"
click node_mobile "https://github.com/comstrx/saasx/tree/main/platform/mobile/src/app"
click node_mobile_api "https://github.com/comstrx/saasx/blob/main/platform/mobile/src/api/client.ts"
click node_mobile_auth "https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/auth"
click node_mobile_catalog "https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/explore"
click node_mobile_checkout "https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/checkout"
click node_mobile_orders "https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/orders"
click node_infra "https://github.com/comstrx/saasx/blob/main/platform/infra/src/main.rs"
click node_skill "https://github.com/comstrx/saasx/blob/main/platform/skill/src/main.rs"

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_rust,node_node toneBlue
class node_api,node_api_contracts toneAmber
class node_web,node_web_specs,node_web_api,node_web_workflow,node_web_routes,node_web_reviews,node_mobile,node_mobile_api,node_mobile_auth,node_mobile_catalog,node_mobile_checkout,node_mobile_orders toneMint
class node_infra toneRose
class node_skill,node_user,node_agent toneIndigo
```

## Components

### Shared foundations

- [Rust foundation](https://github.com/comstrx/saasx/blob/main/engine/rust/crates/base/src/lib.rs): `engine/rust/crates/base/src/lib.rs`
- [TypeScript foundation](https://github.com/comstrx/saasx/blob/main/engine/node/packages/base/src/index.ts): `engine/node/packages/base/src/index.ts`

### Backend services

- [SaaS API services](https://github.com/comstrx/saasx/tree/main/platform/api/crates): `platform/api/crates`
- [API contracts](https://github.com/comstrx/saasx/tree/main/platform/api): `platform/api`

### Customer experiences

- [Web surfaces](https://github.com/comstrx/saasx/tree/main/platform/web): `platform/web`
- [Web specs](https://github.com/comstrx/saasx/tree/main/platform/web/specs): `platform/web/specs`
- [Web API client](https://github.com/comstrx/saasx/blob/main/platform/web/src/api/core/client.ts): `platform/web/src/api/core/client.ts`
- [Server API workflow](https://github.com/comstrx/saasx/blob/main/platform/web/src/api/workflow/server.ts): `platform/web/src/api/workflow/server.ts`
- [Route and query utilities](https://github.com/comstrx/saasx/blob/main/platform/web/src/lib/std/route.ts): `platform/web/src/lib/std/route.ts`
- [Review management](https://github.com/comstrx/saasx/blob/main/platform/web/src/components/review-manager.tsx): `platform/web/src/components/review-manager.tsx`
- [Multi-role mobile app](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/app): `platform/mobile/src/app`
- [Mobile API client](https://github.com/comstrx/saasx/blob/main/platform/mobile/src/api/client.ts): `platform/mobile/src/api/client.ts`
- [Mobile identity flows](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/auth): `platform/mobile/src/features/auth`
- [Catalog and discovery](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/explore): `platform/mobile/src/features/explore`
- [Cart and checkout](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/checkout): `platform/mobile/src/features/checkout`
- [Orders and tickets](https://github.com/comstrx/saasx/tree/main/platform/mobile/src/features/orders): `platform/mobile/src/features/orders`

### Platform operations

- [Infrastructure engine](https://github.com/comstrx/saasx/blob/main/platform/infra/src/main.rs): `platform/infra/src/main.rs`

### Knowledge runtime

- [MCP knowledge runtime](https://github.com/comstrx/saasx/blob/main/platform/skill/src/main.rs): `platform/skill/src/main.rs`

### Other components

- **Customer or staff**
- **AI agent**

## Connections

- Customer or staff → Multi-role mobile app: uses app (evidence: `README.md`)
- Customer or staff → Web surfaces: uses surfaces (evidence: `README.md`)
- Multi-role mobile app → Mobile identity flows: supports identity (evidence: `README.md`)
- Multi-role mobile app → Catalog and discovery: supports discovery (evidence: `README.md`)
- Multi-role mobile app → Cart and checkout: supports checkout (evidence: `README.md`)
- Multi-role mobile app → Orders and tickets: supports orders (evidence: `README.md`)
- Multi-role mobile app → Mobile API client: uses API client
- Mobile API client → SaaS API services: calls services
- Web surfaces → Web specs: declares surfaces (evidence: `README.md`)
- Web surfaces → Server API workflow: loads server data (evidence: `platform/web/src/api/workflow/server.ts`)
- Server API workflow → Web API client: uses client (evidence: `platform/web/src/api/workflow/server.ts`)
- Web API client → Route and query utilities: encodes requests
- Web API client → SaaS API services: calls services
- Web surfaces → Review management: manages reviews (evidence: `platform/web/src/components/review-manager.tsx`)
- Review management → SaaS API services: persists review actions
- SaaS API services → API contracts: exposes contracts (evidence: `README.md`)
- SaaS API services → Rust foundation: builds on (evidence: `README.md`)
- Web surfaces → TypeScript foundation: builds on (evidence: `README.md`)
- Multi-role mobile app → TypeScript foundation: builds on (evidence: `README.md`)
- Infrastructure engine → Rust foundation: builds on (evidence: `README.md`)
- AI agent → MCP knowledge runtime: queries MCP (evidence: `README.md`)
- MCP knowledge runtime → Rust foundation: builds on
