# mizcausevic-dev/contract-clause-obligation-graph architecture

> Architecture diagram of the GitHub repository mizcausevic-dev/contract-clause-obligation-graph, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mizcausevic-dev/contract-clause-obligation-graph
- Repository: https://github.com/mizcausevic-dev/contract-clause-obligation-graph

## Overview

#### Purpose and principal workflow

This is a deterministic TypeScript control plane for making contract clauses, linked obligations, owners, deadlines, and review blockers visible together. An external HTTP client—typically a browser user or API consumer—initiates the main workflow by requesting an HTML route or JSON endpoint; the app serves a rendered view or a computed response from bundled sample data. It is a static demo, not a live contract-ingestion or AI-extraction system.

#### Components

##### HTTP application
- **Express routes** — `src/app.ts`: Creates the Express app, exposes the documented HTML and JSON routes, calls the corresponding rendering or data functions, and listens on the configured port when run directly.

##### Clause and obligation model
- **Sample agreement dataset** — `src/data/sampleClauses.ts`: Defines the clause, obligation-edge, and review-packet types and supplies the in-memory records used throughout the demo.
- **Control-plane computations** — `src/services/contractClauseService.ts`: Derives dashboard counts, category coverage, and the clause, obligation, review, verification, and combined payload responses from those records.

##### Operator-facing surfaces
- **HTML renderers** — `src/services/render.ts`: Builds the overview and detail-page HTML, using control-plane functions to display clause lanes, obligation relationships, review posture, and verification content.
- **HTTP client or browser** — `null` (external): Calls the app’s routes; the README documents both operator pages and JSON API endpoints.

##### Static publishing
- **Static site prerenderer** — `scripts/prerender.ts`: Calls the same renderers and data functions, writes HTML and JSON snapshots into `site/`, and rewrites page links for static hosting.
- **GitHub Pages hosting** — `null` (external): The README documents deployment of the prerendered site to GitHub Pages; the sampled source does not establish the workflow’s exact build-and-deploy steps.

#### Relationships

- **HTTP client or browser -> Express routes**: Sends HTTP requests to the app’s HTML or JSON endpoints; routes are registered in the application.
- **Express routes -> HTML renderers**: Calls page render functions for HTML responses.
- **Express routes -> Control-plane computations**: Calls data functions and returns their results as JSON.
- **HTML renderers -> Control-plane computations**: Reads summary, clause, obligation, review, category, and verification results to construct page content.
- **Control-plane computations -> Sample agreement dataset**: Reads the bundled records to calculate dashboard and category values and provide clause, edge, and review data.
- **Static site prerenderer -> HTML renderers**: Calls the page render functions to produce static HTML files.
- **Static site prerenderer -> Control-plane computations**: Calls the data functions to produce static JSON files.
- **Static site prerenderer -> GitHub Pages hosting**: Supplies the generated site as the documented deployment artifact; exact workflow wiring is not established by the sampled source.

#### Coverage limits

The sample does not include the full renderer or deployment workflow source, so exact page composition and CI deployment sequencing cannot be confirmed. No live ingestion, persistence, external AI/provider integration, or contract-processing runtime is evidenced; the README and sampled code describe a deterministic demo backed by in-memory data.

Main entry points: [`src/services/contractClauseService.ts`](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/contractClauseService.ts) (Control-plane computations), [`scripts/prerender.ts`](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/scripts/prerender.ts) (Static site prerenderer), [`src/app.ts`](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/app.ts) (Express routes), [`src/services/render.ts`](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/render.ts) (HTML renderers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP application"]
  node_routes["Express routes<br/>HTTP application"]
end

subgraph group_domain["Clause and obligation model"]
  node_dataset["Sample agreement data<br/>In-memory records"]
  node_computations["Control-plane computations<br/>Domain service"]
end

subgraph group_surfaces["Operator-facing surfaces"]
  node_renderers["HTML renderers<br/>Page rendering"]
end

subgraph group_publishing["Static publishing"]
  node_prerenderer["Static site prerenderer<br/>Build script"]
end

node_client["HTTP client<br/>External client"]
node_hosting["GitHub Pages<br/>Static hosting"]

node_client -->|"HTTP requests"| node_routes
node_routes -->|"renders pages"| node_renderers
node_routes -->|"gets JSON data"| node_computations
node_renderers -->|"reads results"| node_computations
node_computations -->|"reads records"| node_dataset
node_prerenderer -->|"renders pages"| node_renderers
node_prerenderer -->|"gets data"| node_computations
node_prerenderer -->|"supplies generated site"| node_hosting

click node_routes "https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/app.ts"
click node_dataset "https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/data/sampleClauses.ts"
click node_computations "https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/contractClauseService.ts"
click node_renderers "https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/render.ts"
click node_prerenderer "https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/scripts/prerender.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_routes,node_client toneBlue
class node_dataset,node_computations toneAmber
class node_renderers toneMint
class node_prerenderer toneRose
class node_hosting toneIndigo
```

## Components

### HTTP application

- [Express routes](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/app.ts): HTTP application · `src/app.ts`

### Clause and obligation model

- [Sample agreement data](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/data/sampleClauses.ts): In-memory records · `src/data/sampleClauses.ts`
- [Control-plane computations](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/contractClauseService.ts): Domain service · `src/services/contractClauseService.ts`

### Operator-facing surfaces

- [HTML renderers](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/src/services/render.ts): Page rendering · `src/services/render.ts`

### Static publishing

- [Static site prerenderer](https://github.com/mizcausevic-dev/contract-clause-obligation-graph/blob/main/scripts/prerender.ts): Build script · `scripts/prerender.ts`

### Other components

- **HTTP client**: External client · Browser user or API consumer
- **GitHub Pages**: Static hosting · Documented deployment target; exact workflow wiring is not established

## Connections

- HTTP client → Express routes: HTTP requests
- Express routes → HTML renderers: renders pages
- Express routes → Control-plane computations: gets JSON data
- HTML renderers → Control-plane computations: reads results
- Control-plane computations → Sample agreement data: reads records
- Static site prerenderer → HTML renderers: renders pages
- Static site prerenderer → Control-plane computations: gets data
- Static site prerenderer → GitHub Pages: supplies generated site · Documented deployment artifact; exact workflow wiring is not established
