# push2006/finder-hsn-codee architecture

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

- Interactive diagram: https://gitdiagram.com/push2006/finder-hsn-codee
- Repository: https://github.com/push2006/finder-hsn-codee

## Overview

Worldwide HSN Code Finder is an offline-first tariff-code search and trade-decision product. A user searches a product or foreign code; the browser finds and displays the national tariff line, then presents code-linked duties, trade, risk, documents, and logistics context. Optional AI assistance and live ship data use a separate proxy. The README documents these capabilities and the proxy boundary; sampled source confirms the browser app’s data imports, but much of the application and several datasets were not sampled, so those branches reflect documented features rather than inspected internals.

Main entry points: [`src/app.js`](https://github.com/push2006/finder-hsn-codee/blob/main/src/app.js) (Finder interface), [`proxy.js`](https://github.com/push2006/finder-hsn-codee/blob/main/proxy.js) (AI and AIS proxy), [`src/tradevalues.ts`](https://github.com/push2006/finder-hsn-codee/blob/main/src/tradevalues.ts) (Trade values), [`src`](https://github.com/push2006/finder-hsn-codee/tree/main/src) (Tariff code dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_finder["Code discovery"]
  node_app["Finder interface<br/>[app.js]"]
  node_tariffdata[("Tariff code dataset")]
  node_aliases[("Search aliases<br/>[aliases.ts]")]
  node_crosswalk[("Code correlation<br/>[hscorr.ts]")]
end

subgraph group_tariffs["Tariff detail"]
  node_duties[("Duty and GST<br/>[gstmap.ts]")]
  node_fta[("FTA duty cuts<br/>[fta.ts]")]
  node_documents[("Trade documents<br/>[docs.ts]")]
  node_certs[("Certificates<br/>[certs.ts]")]
end

subgraph group_intelligence["Trade intelligence"]
  node_tradevalues[("Trade values<br/>[tradevalues.ts]")]
  node_markets[("Markets and partners<br/>[marketdata.ts]")]
  node_seasonality[("Trade seasonality<br/>[tradeseson.ts]")]
  node_pricewatch[("Price trends<br/>[tradetrend.ts]")]
  node_sanctions[("Sanctions and controls<br/>[sanctions.ts]")]
  node_sanctiongap[("Sanction gap analysis<br/>[sancgap.ts]")]
  node_rodtep[("Export incentives<br/>[rodtep.ts]")]
  node_externaldata{{"Official trade sources"}}
end

subgraph group_logistics["Trade logistics"]
  node_worldports[("Port directory<br/>[worldports.ts]")]
  node_portdata[("Port trade data")]
end

subgraph group_services["Optional services"]
  node_proxy["AI and AIS proxy<br/>[proxy.js]"]
  node_ai{{"AI providers"}}
  node_ais{{"AISStream"}}
end

node_trader(("Trader"))

node_trader -->|"searches"| node_app
node_app -->|"searches"| node_tariffdata
node_app -->|"uses"| node_aliases
node_app -->|"correlates codes"| node_crosswalk
node_app -->|"reads rates"| node_duties
node_app -->|"reads cuts"| node_fta
node_app -->|"shows checklists"| node_documents
node_app -->|"reads figures"| node_tradevalues
node_app -->|"shows markets"| node_markets
node_app -->|"shows patterns"| node_seasonality
node_app -->|"shows trends"| node_pricewatch
node_app -->|"shows status"| node_sanctions
node_app -->|"shows gaps"| node_sanctiongap
node_app -->|"shows incentives"| node_rodtep
node_app -->|"shows certificates"| node_certs
node_app -->|"finds ports"| node_worldports
node_app -->|"shows statistics"| node_portdata
node_app -.->|"requests AI and ships"| node_proxy
node_proxy -->|"forwards prompts"| node_ai
node_proxy -->|"receives vessel feed"| node_ais
node_externaldata -->|"supplies figures"| node_tradevalues

click node_app "https://github.com/push2006/finder-hsn-codee/blob/main/src/app.js"
click node_tariffdata "https://github.com/push2006/finder-hsn-codee/tree/main/src"
click node_aliases "https://github.com/push2006/finder-hsn-codee/blob/main/src/aliases.ts"
click node_crosswalk "https://github.com/push2006/finder-hsn-codee/blob/main/src/hscorr.ts"
click node_duties "https://github.com/push2006/finder-hsn-codee/blob/main/src/gstmap.ts"
click node_fta "https://github.com/push2006/finder-hsn-codee/blob/main/src/fta.ts"
click node_documents "https://github.com/push2006/finder-hsn-codee/blob/main/src/docs.ts"
click node_tradevalues "https://github.com/push2006/finder-hsn-codee/blob/main/src/tradevalues.ts"
click node_markets "https://github.com/push2006/finder-hsn-codee/blob/main/src/marketdata.ts"
click node_seasonality "https://github.com/push2006/finder-hsn-codee/blob/main/src/tradeseson.ts"
click node_pricewatch "https://github.com/push2006/finder-hsn-codee/blob/main/src/tradetrend.ts"
click node_sanctions "https://github.com/push2006/finder-hsn-codee/blob/main/src/sanctions.ts"
click node_sanctiongap "https://github.com/push2006/finder-hsn-codee/blob/main/src/sancgap.ts"
click node_rodtep "https://github.com/push2006/finder-hsn-codee/blob/main/src/rodtep.ts"
click node_certs "https://github.com/push2006/finder-hsn-codee/blob/main/src/certs.ts"
click node_worldports "https://github.com/push2006/finder-hsn-codee/blob/main/src/worldports.ts"
click node_portdata "https://github.com/push2006/finder-hsn-codee/tree/main/src"
click node_proxy "https://github.com/push2006/finder-hsn-codee/blob/main/proxy.js"

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_tariffdata,node_aliases,node_crosswalk toneBlue
class node_duties,node_fta,node_documents,node_certs toneAmber
class node_tradevalues,node_markets,node_seasonality,node_pricewatch,node_sanctions,node_sanctiongap,node_rodtep,node_externaldata toneMint
class node_worldports,node_portdata toneRose
class node_proxy,node_ai,node_ais,node_trader toneIndigo
```

## Components

### Code discovery

- [Finder interface](https://github.com/push2006/finder-hsn-codee/blob/main/src/app.js): `src/app.js`
- [Tariff code dataset](https://github.com/push2006/finder-hsn-codee/tree/main/src): `src`
- [Search aliases](https://github.com/push2006/finder-hsn-codee/blob/main/src/aliases.ts): `src/aliases.ts`
- [Code correlation](https://github.com/push2006/finder-hsn-codee/blob/main/src/hscorr.ts): `src/hscorr.ts`

### Tariff detail

- [Duty and GST](https://github.com/push2006/finder-hsn-codee/blob/main/src/gstmap.ts): `src/gstmap.ts`
- [FTA duty cuts](https://github.com/push2006/finder-hsn-codee/blob/main/src/fta.ts): `src/fta.ts`
- [Trade documents](https://github.com/push2006/finder-hsn-codee/blob/main/src/docs.ts): `src/docs.ts`
- [Certificates](https://github.com/push2006/finder-hsn-codee/blob/main/src/certs.ts): `src/certs.ts`

### Trade intelligence

- [Trade values](https://github.com/push2006/finder-hsn-codee/blob/main/src/tradevalues.ts): `src/tradevalues.ts`
- [Markets and partners](https://github.com/push2006/finder-hsn-codee/blob/main/src/marketdata.ts): `src/marketdata.ts`
- [Trade seasonality](https://github.com/push2006/finder-hsn-codee/blob/main/src/tradeseson.ts): `src/tradeseson.ts`
- [Price trends](https://github.com/push2006/finder-hsn-codee/blob/main/src/tradetrend.ts): `src/tradetrend.ts`
- [Sanctions and controls](https://github.com/push2006/finder-hsn-codee/blob/main/src/sanctions.ts): `src/sanctions.ts`
- [Sanction gap analysis](https://github.com/push2006/finder-hsn-codee/blob/main/src/sancgap.ts): `src/sancgap.ts`
- [Export incentives](https://github.com/push2006/finder-hsn-codee/blob/main/src/rodtep.ts): `src/rodtep.ts`
- **Official trade sources**

### Trade logistics

- [Port directory](https://github.com/push2006/finder-hsn-codee/blob/main/src/worldports.ts): `src/worldports.ts`
- [Port trade data](https://github.com/push2006/finder-hsn-codee/tree/main/src): `src`

### Optional services

- [AI and AIS proxy](https://github.com/push2006/finder-hsn-codee/blob/main/proxy.js): `proxy.js`
- **AI providers**
- **AISStream**

### Other components

- **Trader**

## Connections

- Trader → Finder interface: searches (evidence: `README.md`)
- Finder interface → Tariff code dataset: searches (evidence: `src/app.js`)
- Finder interface → Search aliases: uses (evidence: `src/app.js`)
- Finder interface → Code correlation: correlates codes (evidence: `src/app.js`)
- Finder interface → Duty and GST: reads rates (evidence: `src/app.js`)
- Finder interface → FTA duty cuts: reads cuts (evidence: `src/app.js`)
- Finder interface → Trade documents: shows checklists (evidence: `README.md`)
- Finder interface → Trade values: reads figures (evidence: `src/app.js`)
- Finder interface → Markets and partners: shows markets (evidence: `src/app.js`)
- Finder interface → Trade seasonality: shows patterns (evidence: `src/app.js`)
- Finder interface → Price trends: shows trends (evidence: `src/app.js`)
- Finder interface → Sanctions and controls: shows status (evidence: `README.md`)
- Finder interface → Sanction gap analysis: shows gaps (evidence: `src/app.js`)
- Finder interface → Export incentives: shows incentives (evidence: `README.md`)
- Finder interface → Certificates: shows certificates (evidence: `src/app.js`)
- Finder interface → Port directory: finds ports (evidence: `README.md`)
- Finder interface → Port trade data: shows statistics (evidence: `README.md`)
- Finder interface → AI and AIS proxy: requests AI and ships (evidence: `README.md`)
- AI and AIS proxy → AI providers: forwards prompts (evidence: `README.md`)
- AI and AIS proxy → AISStream: receives vessel feed (evidence: `README.md`)
- Official trade sources → Trade values: supplies figures (evidence: `src/tradevalues.ts`)
