# inkithai/dynarq architecture

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

- Interactive diagram: https://gitdiagram.com/inkithai/dynarq
- Repository: https://github.com/inkithai/dynarq

## Overview

Dynarq is a local, dependency-free payment-reminder assistant. Its primary workflow reads invoice and sent-reminder JSON, validates invoices, applies overdue-step rules, and presents actions, approvals, and skipped records on an owner page; a CLI can also write the plan. Owners submit decisions for approval-required reminders, held in memory. The README documents these capabilities, while the supplied source excerpts show the principal calls. Data files and research notes are inputs/supporting material, not runtime components.

Main entry points: [`typescript/src/planData.ts`](https://github.com/inkithai/dynarq/blob/main/typescript/src/planData.ts) (Data loading), [`typescript/src/dates.ts`](https://github.com/inkithai/dynarq/blob/main/typescript/src/dates.ts) (Calendar dates), [`typescript/src/server.ts`](https://github.com/inkithai/dynarq/blob/main/typescript/src/server.ts) (HTTP routes), [`typescript/src/plan.ts`](https://github.com/inkithai/dynarq/blob/main/typescript/src/plan.ts) (Rules engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry points"]
  node_cli["Plan CLI<br/>[cli.ts]"]
  node_app["Web app startup<br/>[app.ts]"]
end

subgraph group_rules["Reminder planning"]
  node_plan_data["Data loading<br/>[planData.ts]"]
  node_planner["Rules engine<br/>[plan.ts]"]
  node_invoice["Invoice validation<br/>[invoice.ts]"]
  node_messages["Reminder wording<br/>[messages.ts]"]
end

subgraph group_owner["Owner review"]
  node_server["HTTP routes<br/>[server.ts]"]
  node_page["Reminder page<br/>[page.ts]"]
  node_decisions[("Decision store<br/>[decisions.ts]")]
end

subgraph group_support["Shared validation"]
  node_dates["Calendar dates<br/>[dates.ts]"]
  node_errors["Input errors<br/>[errors.ts]"]
end

node_owner_actor(("Owner"))
node_invoice_files["Invoice and sent JSON<br/>[invoices.json]"]
node_plan_output["Plan JSON output"]

node_owner_actor -->|"runs plan"| node_cli
node_cli -->|"reads lists"| node_plan_data
node_cli -->|"builds plan"| node_planner
node_cli -->|"writes plan"| node_plan_output
node_owner_actor -->|"opens page"| node_app
node_app -->|"starts server"| node_server
node_server -->|"loads plan"| node_plan_data
node_server -->|"renders page"| node_page
node_server -->|"records decision"| node_decisions
node_page -->|"shows decisions"| node_decisions
node_plan_data -->|"builds plan"| node_planner
node_plan_data -->|"indexes invoices"| node_invoice
node_invoice_files -->|"reads files"| node_plan_data
node_planner -->|"validates entries"| node_invoice
node_planner -->|"builds wording"| node_messages
node_planner -->|"calculates overdue"| node_dates
node_invoice -->|"parses dates"| node_dates
node_messages -->|"formats dates"| node_dates
node_page -->|"formats amounts"| node_messages
node_page -->|"formats dates"| node_dates
node_app -->|"gets today"| node_dates
node_server -->|"formats errors"| node_errors
node_plan_data -->|"formats errors"| node_errors
node_invoice -->|"raises input errors"| node_errors
node_dates -->|"raises input errors"| node_errors

click node_cli "https://github.com/inkithai/dynarq/blob/main/typescript/src/cli.ts"
click node_app "https://github.com/inkithai/dynarq/blob/main/typescript/src/app.ts"
click node_server "https://github.com/inkithai/dynarq/blob/main/typescript/src/server.ts"
click node_page "https://github.com/inkithai/dynarq/blob/main/typescript/src/page.ts"
click node_decisions "https://github.com/inkithai/dynarq/blob/main/typescript/src/decisions.ts"
click node_plan_data "https://github.com/inkithai/dynarq/blob/main/typescript/src/planData.ts"
click node_planner "https://github.com/inkithai/dynarq/blob/main/typescript/src/plan.ts"
click node_invoice "https://github.com/inkithai/dynarq/blob/main/typescript/src/invoice.ts"
click node_messages "https://github.com/inkithai/dynarq/blob/main/typescript/src/messages.ts"
click node_dates "https://github.com/inkithai/dynarq/blob/main/typescript/src/dates.ts"
click node_errors "https://github.com/inkithai/dynarq/blob/main/typescript/src/errors.ts"
click node_invoice_files "https://github.com/inkithai/dynarq/blob/main/data/invoices.json"

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_app toneBlue
class node_plan_data,node_planner,node_invoice,node_messages toneAmber
class node_server,node_page,node_decisions toneMint
class node_dates,node_errors toneRose
class node_owner_actor,node_plan_output toneIndigo
class node_invoice_files toneTeal
```

## Components

### Product entry points

- [Plan CLI](https://github.com/inkithai/dynarq/blob/main/typescript/src/cli.ts): `typescript/src/cli.ts`
- [Web app startup](https://github.com/inkithai/dynarq/blob/main/typescript/src/app.ts): `typescript/src/app.ts`

### Reminder planning

- [Data loading](https://github.com/inkithai/dynarq/blob/main/typescript/src/planData.ts): `typescript/src/planData.ts`
- [Rules engine](https://github.com/inkithai/dynarq/blob/main/typescript/src/plan.ts): `typescript/src/plan.ts`
- [Invoice validation](https://github.com/inkithai/dynarq/blob/main/typescript/src/invoice.ts): `typescript/src/invoice.ts`
- [Reminder wording](https://github.com/inkithai/dynarq/blob/main/typescript/src/messages.ts): `typescript/src/messages.ts`

### Owner review

- [HTTP routes](https://github.com/inkithai/dynarq/blob/main/typescript/src/server.ts): `typescript/src/server.ts`
- [Reminder page](https://github.com/inkithai/dynarq/blob/main/typescript/src/page.ts): `typescript/src/page.ts`
- [Decision store](https://github.com/inkithai/dynarq/blob/main/typescript/src/decisions.ts): `typescript/src/decisions.ts`

### Shared validation

- [Calendar dates](https://github.com/inkithai/dynarq/blob/main/typescript/src/dates.ts): `typescript/src/dates.ts`
- [Input errors](https://github.com/inkithai/dynarq/blob/main/typescript/src/errors.ts): `typescript/src/errors.ts`

### Other components

- **Owner**
- [Invoice and sent JSON](https://github.com/inkithai/dynarq/blob/main/data/invoices.json): `data/invoices.json`
- **Plan JSON output**

## Connections

- Owner → Plan CLI: runs plan (evidence: `README.md`)
- Plan CLI → Data loading: reads lists (evidence: `typescript/src/cli.ts`)
- Plan CLI → Rules engine: builds plan (evidence: `typescript/src/cli.ts`)
- Plan CLI → Plan JSON output: writes plan (evidence: `typescript/src/cli.ts`)
- Owner → Web app startup: opens page (evidence: `README.md`)
- Web app startup → HTTP routes: starts server (evidence: `typescript/src/app.ts`)
- HTTP routes → Data loading: loads plan (evidence: `typescript/src/server.ts`)
- HTTP routes → Reminder page: renders page (evidence: `typescript/src/server.ts`)
- HTTP routes → Decision store: records decision (evidence: `typescript/src/server.ts`)
- Reminder page → Decision store: shows decisions (evidence: `typescript/src/page.ts`)
- Data loading → Rules engine: builds plan (evidence: `typescript/src/planData.ts`)
- Data loading → Invoice validation: indexes invoices (evidence: `typescript/src/planData.ts`)
- Invoice and sent JSON → Data loading: reads files (evidence: `README.md`)
- Rules engine → Invoice validation: validates entries (evidence: `typescript/src/plan.ts`)
- Rules engine → Reminder wording: builds wording (evidence: `typescript/src/plan.ts`)
- Rules engine → Calendar dates: calculates overdue (evidence: `typescript/src/plan.ts`)
- Invoice validation → Calendar dates: parses dates (evidence: `typescript/src/invoice.ts`)
- Reminder wording → Calendar dates: formats dates (evidence: `typescript/src/messages.ts`)
- Reminder page → Reminder wording: formats amounts (evidence: `typescript/src/page.ts`)
- Reminder page → Calendar dates: formats dates (evidence: `typescript/src/page.ts`)
- Web app startup → Calendar dates: gets today (evidence: `typescript/src/app.ts`)
- HTTP routes → Input errors: formats errors (evidence: `typescript/src/server.ts`)
- Data loading → Input errors: formats errors (evidence: `typescript/src/planData.ts`)
- Invoice validation → Input errors: raises input errors (evidence: `typescript/src/invoice.ts`)
- Calendar dates → Input errors: raises input errors (evidence: `typescript/src/dates.ts`)
