# nitinrawat26/mapwright architecture

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

- Interactive diagram: https://gitdiagram.com/nitinrawat26/mapwright
- Repository: https://github.com/nitinrawat26/mapwright

## Overview

MapWright builds normalized profiles for two merchant-acquiring systems, applies domain playbooks and matching rules to produce a versioned field-mapping spec, then supports review, validation, replay, and human-readable exports. Users can work through the CLI or web application; the API and SQLite-backed stores support the web product. The graph preserves documented profile inputs, mapping outputs, AI assistance, playbooks, and web-facing capabilities. Some subsystem links are omitted where the supplied excerpts do not show the caller or data transfer.

Main entry points: [`src/MapWright.Core/Spec/MappingDocument.cs`](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Spec/MappingDocument.cs) (Mapping spec), [`src/MapWright.Cli/CliApp.cs`](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Cli/CliApp.cs) (CLI), [`src/MapWright.Core/Profile/ProfileBuilder.cs`](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Profile/ProfileBuilder.cs) (Profile builder), [`src/MapWright.Core/Matching/MappingBuilder.cs`](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Matching/MappingBuilder.cs) (Mapping builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI<br/>[CliApp.cs]"]
  node_web["Web application<br/>[app.routes.ts]"]
  node_api["HTTP API<br/>[Program.cs]"]
end

subgraph group_profile["System profiles"]
  node_inputs["Profile input readers<br/>[ProfileInputs.cs]"]
  node_contracts["Contract readers<br/>[Contracts]"]
  node_profilebuilder["Profile builder<br/>[ProfileBuilder.cs]"]
  node_profilemodel["System profile<br/>[SystemProfile.cs]"]
end

subgraph group_mapping["Mapping engine"]
  node_playbooks["Domain playbooks<br/>[Playbook.cs]"]
  node_playbooklibrary["Playbook library<br/>[PlaybookLibrary.cs]"]
  node_mappingengine["Mapping generation"]
  node_mappingbuilder["Mapping builder<br/>[MappingBuilder.cs]"]
  node_mappingspec["Mapping spec<br/>[MappingDocument.cs]"]
  node_ai["AI assistance"]
  node_aiprovider["AI providers<br/>[IAiProvider.cs]"]
end

subgraph group_operations["Review and execution"]
  node_validation["Spec validation"]
  node_replay["Mapping replay<br/>[TransformEngine.cs]"]
  node_reports["Document renderers<br/>[Renderers]"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite database")]
  node_stores["Domain stores<br/>[MapWright.Store]"]
end

node_cli -->|"reads inputs"| node_inputs
node_cli -->|"builds profiles"| node_profilebuilder
node_cli -->|"generates mappings"| node_mappingengine
node_cli -->|"renders exports"| node_reports
node_inputs -->|"reads contracts"| node_contracts
node_profilebuilder -.->|"produces profile"| node_profilemodel
node_profilebuilder -->|"uses readers"| node_contracts
node_mappingengine -->|"delegates mapping"| node_mappingbuilder
node_mappingbuilder -->|"matches playbooks"| node_playbooklibrary
node_mappingbuilder -->|"builds spec"| node_mappingspec
node_playbooklibrary -->|"selects active"| node_playbooks
node_ai -->|"requests completions"| node_aiprovider
node_ai -->|"suggests rows"| node_mappingspec
node_validation -->|"validates spec"| node_mappingspec
node_replay -->|"executes mappings"| node_mappingspec
node_reports -->|"renders spec"| node_mappingspec
node_api -->|"configures database"| node_database
node_api -->|"registers stores"| node_stores
node_stores -->|"opens connections"| node_database
node_web -.->|"calls API"| node_api

click node_cli "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Cli/CliApp.cs"
click node_web "https://github.com/nitinrawat26/mapwright/blob/main/web/src/app/app.routes.ts"
click node_api "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Api/Program.cs"
click node_inputs "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Output/Readers/ProfileInputs.cs"
click node_contracts "https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Core/Profile/Contracts"
click node_profilebuilder "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Profile/ProfileBuilder.cs"
click node_profilemodel "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Profile/SystemProfile.cs"
click node_playbooks "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Playbooks/Playbook.cs"
click node_playbooklibrary "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Playbooks/PlaybookLibrary.cs"
click node_mappingengine "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Matching/MappingGenerator.cs"
click node_mappingbuilder "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Matching/MappingBuilder.cs"
click node_mappingspec "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Spec/MappingDocument.cs"
click node_ai "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Ai/AiMappingAssistant.cs"
click node_aiprovider "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Ai/IAiProvider.cs"
click node_validation "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Spec/MappingSpecValidator.cs"
click node_replay "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Replay/TransformEngine.cs"
click node_reports "https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Output/Renderers"
click node_database "https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Store/MapWrightDatabase.cs"
click node_stores "https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Store"

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_cli,node_web,node_api toneBlue
class node_inputs,node_contracts,node_profilebuilder,node_profilemodel toneAmber
class node_playbooks,node_playbooklibrary,node_mappingengine,node_mappingbuilder,node_mappingspec,node_ai,node_aiprovider toneMint
class node_validation,node_replay,node_reports toneRose
class node_database,node_stores toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Cli/CliApp.cs): `src/MapWright.Cli/CliApp.cs`
- [Web application](https://github.com/nitinrawat26/mapwright/blob/main/web/src/app/app.routes.ts): `web/src/app/app.routes.ts`
- [HTTP API](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Api/Program.cs): `src/MapWright.Api/Program.cs`

### System profiles

- [Profile input readers](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Output/Readers/ProfileInputs.cs): `src/MapWright.Output/Readers/ProfileInputs.cs`
- [Contract readers](https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Core/Profile/Contracts): `src/MapWright.Core/Profile/Contracts`
- [Profile builder](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Profile/ProfileBuilder.cs): `src/MapWright.Core/Profile/ProfileBuilder.cs`
- [System profile](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Profile/SystemProfile.cs): `src/MapWright.Core/Profile/SystemProfile.cs`

### Mapping engine

- [Domain playbooks](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Playbooks/Playbook.cs): `src/MapWright.Core/Playbooks/Playbook.cs`
- [Playbook library](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Playbooks/PlaybookLibrary.cs): `src/MapWright.Core/Playbooks/PlaybookLibrary.cs`
- [Mapping generation](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Matching/MappingGenerator.cs): `src/MapWright.Core/Matching/MappingGenerator.cs`
- [Mapping builder](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Matching/MappingBuilder.cs): `src/MapWright.Core/Matching/MappingBuilder.cs`
- [Mapping spec](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Spec/MappingDocument.cs): `src/MapWright.Core/Spec/MappingDocument.cs`
- [AI assistance](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Ai/AiMappingAssistant.cs): `src/MapWright.Ai/AiMappingAssistant.cs`
- [AI providers](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Ai/IAiProvider.cs): `src/MapWright.Ai/IAiProvider.cs`

### Review and execution

- [Spec validation](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Spec/MappingSpecValidator.cs): `src/MapWright.Core/Spec/MappingSpecValidator.cs`
- [Mapping replay](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Core/Replay/TransformEngine.cs): `src/MapWright.Core/Replay/TransformEngine.cs`
- [Document renderers](https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Output/Renderers): `src/MapWright.Output/Renderers`

### Persistence

- [SQLite database](https://github.com/nitinrawat26/mapwright/blob/main/src/MapWright.Store/MapWrightDatabase.cs): `src/MapWright.Store/MapWrightDatabase.cs`
- [Domain stores](https://github.com/nitinrawat26/mapwright/tree/main/src/MapWright.Store): `src/MapWright.Store`

## Connections

- CLI → Profile input readers: reads inputs (evidence: `src/MapWright.Cli/CliApp.cs`)
- CLI → Profile builder: builds profiles (evidence: `src/MapWright.Cli/CliApp.cs`)
- CLI → Mapping generation: generates mappings (evidence: `src/MapWright.Cli/CliApp.cs`)
- CLI → Document renderers: renders exports (evidence: `src/MapWright.Cli/CliApp.cs`)
- Profile input readers → Contract readers: reads contracts
- Profile builder → System profile: produces profile
- Profile builder → Contract readers: uses readers (evidence: `src/MapWright.Core/Profile/Contracts/XsdReader.cs`)
- Mapping generation → Mapping builder: delegates mapping (evidence: `src/MapWright.Core/Matching/MappingGenerator.cs`)
- Mapping builder → Playbook library: matches playbooks (evidence: `src/MapWright.Core/Matching/MappingBuilder.cs`)
- Mapping builder → Mapping spec: builds spec (evidence: `src/MapWright.Core/Matching/MappingBuilder.cs`)
- Playbook library → Domain playbooks: selects active (evidence: `src/MapWright.Core/Playbooks/PlaybookLibrary.cs`)
- AI assistance → AI providers: requests completions (evidence: `src/MapWright.Ai/AiMappingAssistant.cs`)
- AI assistance → Mapping spec: suggests rows (evidence: `src/MapWright.Ai/AiMappingAssistant.cs`)
- Spec validation → Mapping spec: validates spec (evidence: `src/MapWright.Core/Spec/MappingSpecValidator.cs`)
- Mapping replay → Mapping spec: executes mappings (evidence: `src/MapWright.Core/Replay/TransformEngine.cs`)
- Document renderers → Mapping spec: renders spec
- HTTP API → SQLite database: configures database (evidence: `src/MapWright.Api/Program.cs`)
- HTTP API → Domain stores: registers stores (evidence: `src/MapWright.Api/Program.cs`)
- Domain stores → SQLite database: opens connections (evidence: `src/MapWright.Store/MapWrightDatabase.cs`)
- Web application → HTTP API: calls API
