# janithbandara1/dynarq-task architecture

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

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

## Overview

Dynarq is a small-business payment-reminder assistant. Its main workflow reads invoice and sent-reminder data, validates dates and invoice records, plans at most one due reminder per invoice, and generates a message. The TypeScript command writes the plan; the owner’s web page uses the same rules, shows actions and skipped records, and records approval decisions in memory. The README also specifies owner research notes based on the supplied source documents. The sampled TypeScript files show the runtime wiring; research implementation was not sampled.

Main entry points: [`typescript/src/app.ts`](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/app.ts) (HTTP application), [`typescript/src/plan.ts`](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/plan.ts) (Plan command), [`typescript/src/rules.ts`](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/rules.ts) (Rules engine), [`typescript/src/page.ts`](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/page.ts) (Page renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Invoice inputs"]
  node_invoices["Invoice records<br/>[invoices.json]"]
  node_sent["Sent reminders<br/>[sent.json]"]
end

subgraph group_planning["Reminder planning"]
  node_cli["Plan command<br/>[plan.ts]"]
  node_rules["Rules engine<br/>[rules.ts]"]
  node_dates["Date validation<br/>[dates.ts]"]
  node_messages["Message builder<br/>[messages.ts]"]
  node_plan_file["Plan JSON output"]
end

subgraph group_owner_page["Owner page"]
  node_app["HTTP application<br/>[app.ts]"]
  node_page["Page renderer<br/>[page.ts]"]
  node_decisions[("Approval decisions<br/>[app.ts]")]
end

subgraph group_research["Owner research"]
  node_research_notes["Research answers<br/>[RESEARCH.md]"]
  node_research_sources["Research sources"]
end

node_operator(("Business owner"))

node_operator -->|"runs command"| node_cli
node_cli -->|"reads records"| node_invoices
node_cli -->|"reads history"| node_sent
node_cli -->|"builds plan"| node_rules
node_rules -->|"parses dates"| node_dates
node_rules -->|"builds message"| node_messages
node_cli -->|"writes plan"| node_plan_file
node_operator -->|"opens page"| node_app
node_app -->|"reads records"| node_invoices
node_app -->|"reads history"| node_sent
node_app -->|"validates today"| node_dates
node_app -->|"builds plan"| node_rules
node_app -->|"renders page"| node_page
node_page -->|"formats amounts"| node_messages
node_app -->|"records choice"| node_decisions
node_operator -.->|"reads answers"| node_research_notes
node_research_sources -.->|"informs research"| node_research_notes

click node_invoices "https://github.com/janithbandara1/dynarq-task/blob/main/data/invoices.json"
click node_sent "https://github.com/janithbandara1/dynarq-task/blob/main/data/sent.json"
click node_cli "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/plan.ts"
click node_rules "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/rules.ts"
click node_dates "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/dates.ts"
click node_messages "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/messages.ts"
click node_app "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/app.ts"
click node_page "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/page.ts"
click node_decisions "https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/app.ts"
click node_research_notes "https://github.com/janithbandara1/dynarq-task/blob/main/RESEARCH.md"
click node_research_sources "https://github.com/janithbandara1/dynarq-task/tree/main/sources"

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_invoices,node_sent toneBlue
class node_cli,node_rules,node_dates,node_messages,node_plan_file toneAmber
class node_app,node_page,node_decisions toneMint
class node_research_notes,node_research_sources toneRose
class node_operator toneIndigo
```

## Components

### Invoice inputs

- [Invoice records](https://github.com/janithbandara1/dynarq-task/blob/main/data/invoices.json): `data/invoices.json`
- [Sent reminders](https://github.com/janithbandara1/dynarq-task/blob/main/data/sent.json): `data/sent.json`

### Reminder planning

- [Plan command](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/plan.ts): `typescript/src/plan.ts`
- [Rules engine](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/rules.ts): `typescript/src/rules.ts`
- [Date validation](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/dates.ts): `typescript/src/dates.ts`
- [Message builder](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/messages.ts): `typescript/src/messages.ts`
- **Plan JSON output**

### Owner page

- [HTTP application](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/app.ts): `typescript/src/app.ts`
- [Page renderer](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/page.ts): `typescript/src/page.ts`
- [Approval decisions](https://github.com/janithbandara1/dynarq-task/blob/main/typescript/src/app.ts): `typescript/src/app.ts`

### Owner research

- [Research answers](https://github.com/janithbandara1/dynarq-task/blob/main/RESEARCH.md): `RESEARCH.md`
- [Research sources](https://github.com/janithbandara1/dynarq-task/tree/main/sources): `sources`

### Other components

- **Business owner**

## Connections

- Business owner → Plan command: runs command (evidence: `README.md`)
- Plan command → Invoice records: reads records (evidence: `typescript/src/plan.ts`)
- Plan command → Sent reminders: reads history (evidence: `typescript/src/plan.ts`)
- Plan command → Rules engine: builds plan (evidence: `typescript/src/plan.ts`)
- Rules engine → Date validation: parses dates (evidence: `typescript/src/rules.ts`)
- Rules engine → Message builder: builds message (evidence: `typescript/src/rules.ts`)
- Plan command → Plan JSON output: writes plan (evidence: `typescript/src/plan.ts`)
- Business owner → HTTP application: opens page (evidence: `README.md`)
- HTTP application → Invoice records: reads records (evidence: `typescript/src/app.ts`)
- HTTP application → Sent reminders: reads history (evidence: `typescript/src/app.ts`)
- HTTP application → Date validation: validates today (evidence: `typescript/src/app.ts`)
- HTTP application → Rules engine: builds plan (evidence: `typescript/src/app.ts`)
- HTTP application → Page renderer: renders page (evidence: `typescript/src/app.ts`)
- Page renderer → Message builder: formats amounts (evidence: `typescript/src/page.ts`)
- HTTP application → Approval decisions: records choice (evidence: `typescript/src/app.ts`)
- Business owner → Research answers: reads answers (evidence: `README.md`)
- Research sources → Research answers: informs research (evidence: `README.md`)
