# sandeepwebdev19/marxdev architecture

> Architecture diagram of the GitHub repository sandeepwebdev19/marxdev, 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/sandeepwebdev19/marxdev
- Repository: https://github.com/sandeepwebdev19/marxdev

## Overview

ArchiFlow is a WAM-based architecture modeling product. Users authenticate, create and edit diagrams on an interactive canvas, validate and estimate them, then save, export, or publish their work. AI chat, image-to-diagram and repair extend the modeling workflow; subscriptions govern feature access. The graph includes the documented authentication, persistence, integration, pricing, and export branches. Some frontend-to-API wiring and unsampled subsystems are documented only at product level, so those relationships are marked as unverified rather than inferred from names.

Main entry points: [`frontend/src/components/Canvas/EditorLayout.tsx`](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/EditorLayout.tsx) (Editor workspace), [`backend/models/ai/ai.service.js`](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/ai.service.js) (AI diagram service), [`backend/models/User.js`](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/User.js) (User accounts), [`backend/routes/subscription.js`](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/subscription.js) (Subscription management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Diagram editor"]
  node_app["Web application<br/>[App.tsx]"]
  node_editor_layout["Editor workspace<br/>[EditorLayout.tsx]"]
  node_canvas["WAM canvas<br/>[MainCanvas.tsx]"]
  node_palette["Element palette<br/>[WamPalette.tsx]"]
  node_properties["Element properties"]
  node_validation_ui["Validation feedback"]
end

subgraph group_backend["API and modeling"]
  node_diagram_api["Diagram operations<br/>[diagrams.js]"]
  node_diagram_store[("Diagram records<br/>[Diagram.js]")]
  node_wam_validation["WAM validation<br/>[wam.validator.js]"]
end

subgraph group_identity["Identity and plans"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_auth_api["Authentication<br/>[auth.js]"]
  node_user_store[("User accounts<br/>[User.js]")]
  node_plans["Plan limits"]
  node_subscription_api["Subscription management<br/>[subscription.js]"]
end

subgraph group_intelligence["AI and estimates"]
  node_chat_ui["AI assistant<br/>[ChatWidget.tsx]"]
  node_ai_api["AI endpoints<br/>[ai.routes.js]"]
  node_ai_service["AI diagram service<br/>[ai.service.js]"]
  node_openai["OpenAI provider<br/>[openai.provider.js]"]
  node_cost_ui["Cost estimate UI"]
  node_cost_api["Cost estimator API<br/>[costEstimate.js]"]
  node_cost_engine["Cost model<br/>[costEstimator.js]"]
end

subgraph group_extensions["Exports and integrations"]
  node_integrations_ui["Integrations portal"]
  node_integrations_api["Integration management<br/>[integrations.js]"]
  node_exporter["JSON-LD export<br/>[exportJSONLD.ts]"]
end

node_user(("Architecture user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_editor_layout
node_editor_layout -->|"embeds"| node_canvas
node_editor_layout -->|"renders"| node_palette
node_editor_layout -->|"renders"| node_properties
node_editor_layout -->|"shows"| node_validation_ui
node_editor_layout -.->|"saves and loads"| node_diagram_api
node_diagram_api -->|"reads and writes"| node_diagram_store
node_editor_layout -.->|"requests validation"| node_wam_validation
node_user -->|"signs in"| node_auth_context
node_auth_context -->|"fetches user"| node_auth_api
node_auth_api -->|"reads and updates"| node_user_store
node_subscription_api -->|"updates plan"| node_user_store
node_subscription_api -->|"checks plans"| node_plans
node_ai_api -->|"dispatches prompts"| node_ai_service
node_ai_service -->|"generates diagrams"| node_openai
node_ai_service -->|"validates output"| node_wam_validation
node_chat_ui -.->|"sends prompts"| node_ai_api
node_cost_ui -.->|"requests estimate"| node_cost_api
node_cost_api -->|"estimates costs"| node_cost_engine
node_integrations_ui -.->|"manages connections"| node_integrations_api
node_editor_layout -->|"exports diagram"| node_exporter
node_integrations_api -->|"stores credentials"| node_user_store

click node_app "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/App.tsx"
click node_editor_layout "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/EditorLayout.tsx"
click node_canvas "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/MainCanvas.tsx"
click node_palette "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Palette/WamPalette.tsx"
click node_properties "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Palette/PropertyMngPanel.tsx"
click node_validation_ui "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/ValidationPanel.tsx"
click node_diagram_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/diagrams.js"
click node_diagram_store "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/Diagram.js"
click node_wam_validation "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/wam/wam.validator.js"
click node_auth_context "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/context/AuthContext.tsx"
click node_auth_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/auth.js"
click node_user_store "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/User.js"
click node_plans "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/config/subscriptionPlans.js"
click node_subscription_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/subscription.js"
click node_chat_ui "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/chat/ChatWidget.tsx"
click node_ai_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/ai.routes.js"
click node_ai_service "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/ai.service.js"
click node_openai "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/providers/openai.provider.js"
click node_cost_ui "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/CostEstimate/CostEstimateModal.tsx"
click node_cost_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/costEstimate.js"
click node_cost_engine "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/common/costEstimator.js"
click node_integrations_ui "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Integrations/IntegrationsPage.tsx"
click node_integrations_api "https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/integrations.js"
click node_exporter "https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/utils/exportJSONLD.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_app,node_editor_layout,node_canvas,node_palette,node_properties,node_validation_ui,node_user toneBlue
class node_diagram_api,node_diagram_store,node_wam_validation toneAmber
class node_auth_context,node_auth_api,node_user_store,node_plans,node_subscription_api toneMint
class node_chat_ui,node_ai_api,node_ai_service,node_openai,node_cost_ui,node_cost_api,node_cost_engine toneRose
class node_integrations_ui,node_integrations_api,node_exporter toneIndigo
```

## Components

### Diagram editor

- [Web application](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Editor workspace](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/EditorLayout.tsx): `frontend/src/components/Canvas/EditorLayout.tsx`
- [WAM canvas](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/MainCanvas.tsx): `frontend/src/components/Canvas/MainCanvas.tsx`
- [Element palette](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Palette/WamPalette.tsx): `frontend/src/components/Palette/WamPalette.tsx`
- [Element properties](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Palette/PropertyMngPanel.tsx): `frontend/src/components/Palette/PropertyMngPanel.tsx`
- [Validation feedback](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Canvas/ValidationPanel.tsx): `frontend/src/components/Canvas/ValidationPanel.tsx`

### API and modeling

- [Diagram operations](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/diagrams.js): `backend/routes/diagrams.js`
- [Diagram records](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/Diagram.js): `backend/models/Diagram.js`
- [WAM validation](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/wam/wam.validator.js): `backend/models/wam/wam.validator.js`

### Identity and plans

- [Session context](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Authentication](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [User accounts](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/User.js): `backend/models/User.js`
- [Plan limits](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/config/subscriptionPlans.js): `backend/config/subscriptionPlans.js`
- [Subscription management](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/subscription.js): `backend/routes/subscription.js`

### AI and estimates

- [AI assistant](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/chat/ChatWidget.tsx): `frontend/src/components/chat/ChatWidget.tsx`
- [AI endpoints](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/ai.routes.js): `backend/models/ai/ai.routes.js`
- [AI diagram service](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/ai.service.js): `backend/models/ai/ai.service.js`
- [OpenAI provider](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/models/ai/providers/openai.provider.js): `backend/models/ai/providers/openai.provider.js`
- [Cost estimate UI](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/CostEstimate/CostEstimateModal.tsx): `frontend/src/components/CostEstimate/CostEstimateModal.tsx`
- [Cost estimator API](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/costEstimate.js): `backend/routes/costEstimate.js`
- [Cost model](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/common/costEstimator.js): `backend/common/costEstimator.js`

### Exports and integrations

- [Integrations portal](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/components/Integrations/IntegrationsPage.tsx): `frontend/src/components/Integrations/IntegrationsPage.tsx`
- [Integration management](https://github.com/sandeepwebdev19/marxdev/blob/main/backend/routes/integrations.js): `backend/routes/integrations.js`
- [JSON-LD export](https://github.com/sandeepwebdev19/marxdev/blob/main/frontend/src/utils/exportJSONLD.ts): `frontend/src/utils/exportJSONLD.ts`

### Other components

- **Architecture user**

## Connections

- Architecture user → Web application: uses
- Web application → Editor workspace: routes to (evidence: `frontend/src/App.tsx`)
- Editor workspace → WAM canvas: embeds (evidence: `frontend/src/components/Canvas/EditorLayout.tsx`)
- Editor workspace → Element palette: renders (evidence: `frontend/src/components/Canvas/EditorLayout.tsx`)
- Editor workspace → Element properties: renders (evidence: `frontend/src/components/Canvas/EditorLayout.tsx`)
- Editor workspace → Validation feedback: shows (evidence: `frontend/src/components/Canvas/EditorLayout.tsx`)
- Editor workspace → Diagram operations: saves and loads
- Diagram operations → Diagram records: reads and writes (evidence: `backend/routes/diagrams.js`)
- Editor workspace → WAM validation: requests validation
- Architecture user → Session context: signs in
- Session context → Authentication: fetches user (evidence: `frontend/src/context/AuthContext.tsx`)
- Authentication → User accounts: reads and updates (evidence: `backend/routes/auth.js`)
- Subscription management → User accounts: updates plan (evidence: `backend/routes/subscription.js`)
- Subscription management → Plan limits: checks plans (evidence: `backend/routes/subscription.js`)
- AI endpoints → AI diagram service: dispatches prompts (evidence: `backend/models/ai/ai.routes.js`)
- AI diagram service → OpenAI provider: generates diagrams (evidence: `backend/models/ai/ai.service.js`)
- AI diagram service → WAM validation: validates output (evidence: `backend/models/ai/ai.service.js`)
- AI assistant → AI endpoints: sends prompts
- Cost estimate UI → Cost estimator API: requests estimate
- Cost estimator API → Cost model: estimates costs (evidence: `backend/routes/costEstimate.js`)
- Integrations portal → Integration management: manages connections
- Editor workspace → JSON-LD export: exports diagram (evidence: `frontend/src/components/Canvas/EditorLayout.tsx`)
- Integration management → User accounts: stores credentials (evidence: `backend/routes/integrations.js`)
