# itsmerockyfiles/argusapi architecture

> Architecture diagram of the GitHub repository itsmerockyfiles/argusapi, 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/itsmerockyfiles/argusapi
- Repository: https://github.com/itsmerockyfiles/argusapi

## Overview

Argus is an OFAC sanctions-list screening API. Clients submit entity details; the HTTP server applies optional RapidAPI proxy authentication, screens the in-memory SDN records, and returns ranked matches. Separate API branches expose record lookup, health and dataset statistics, while an authenticated rebuild operation refreshes the feed and reloads the store. The README documents XML-to-JSON dataset generation, but the generated data directory is absent from the supplied tree; its artifact is shown without a source path. The rebuild and dataset-generation behavior is supported by the sampled builder and server code.

Main entry points: [`src/server.js`](https://github.com/itsmerockyfiles/argusapi/blob/main/src/server.js) (Express API), [`src/store.js`](https://github.com/itsmerockyfiles/argusapi/blob/main/src/store.js) (Memory Store), [`src/screen.js`](https://github.com/itsmerockyfiles/argusapi/blob/main/src/screen.js) (Screening Engine), [`scripts/build-sdn.js`](https://github.com/itsmerockyfiles/argusapi/blob/main/scripts/build-sdn.js) (Feed Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["Express API<br/>[server.js]"]
  node_auth["Proxy Auth<br/>[rapidApiAuth.js]"]
  node_api_entry["API Entry<br/>[index.js]"]
  node_logger["Structured Logger<br/>[logger.js]"]
end

subgraph group_screen["Screening"]
  node_screen_engine["Screening Engine<br/>[screen.js]"]
  node_validation["Input Errors<br/>[errors.js]"]
end

subgraph group_data["SDN Data"]
  node_store[("Memory Store<br/>[store.js]")]
  node_sdn_json["SDN Dataset"]
  node_builder["Feed Builder<br/>[build-sdn.js]"]
end

node_client(("API Client"))
node_ofac(("OFAC Feed"))

node_client -->|"sends requests"| node_server
node_api_entry -->|"exports app"| node_server
node_server -->|"guards routes"| node_auth
node_server -->|"screens query"| node_screen_engine
node_screen_engine -->|"throws errors"| node_validation
node_screen_engine -->|"reads entries"| node_store
node_server -->|"reads stats and records"| node_store
node_server -->|"triggers rebuild"| node_builder
node_server -->|"reloads data"| node_store
node_builder -->|"downloads XML"| node_ofac
node_builder -->|"writes dataset"| node_sdn_json
node_store -->|"loads dataset"| node_sdn_json
node_server -->|"logs requests and errors"| node_logger

click node_server "https://github.com/itsmerockyfiles/argusapi/blob/main/src/server.js"
click node_auth "https://github.com/itsmerockyfiles/argusapi/blob/main/src/middleware/rapidApiAuth.js"
click node_api_entry "https://github.com/itsmerockyfiles/argusapi/blob/main/api/index.js"
click node_screen_engine "https://github.com/itsmerockyfiles/argusapi/blob/main/src/screen.js"
click node_validation "https://github.com/itsmerockyfiles/argusapi/blob/main/src/errors.js"
click node_store "https://github.com/itsmerockyfiles/argusapi/blob/main/src/store.js"
click node_builder "https://github.com/itsmerockyfiles/argusapi/blob/main/scripts/build-sdn.js"
click node_logger "https://github.com/itsmerockyfiles/argusapi/blob/main/src/logger.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_server,node_auth,node_api_entry,node_logger,node_client toneBlue
class node_screen_engine,node_validation toneAmber
class node_store,node_sdn_json,node_builder toneMint
class node_ofac toneIndigo
```

## Components

### HTTP API

- [Express API](https://github.com/itsmerockyfiles/argusapi/blob/main/src/server.js): `src/server.js`
- [Proxy Auth](https://github.com/itsmerockyfiles/argusapi/blob/main/src/middleware/rapidApiAuth.js): `src/middleware/rapidApiAuth.js`
- [API Entry](https://github.com/itsmerockyfiles/argusapi/blob/main/api/index.js): `api/index.js`
- [Structured Logger](https://github.com/itsmerockyfiles/argusapi/blob/main/src/logger.js): `src/logger.js`

### Screening

- [Screening Engine](https://github.com/itsmerockyfiles/argusapi/blob/main/src/screen.js): `src/screen.js`
- [Input Errors](https://github.com/itsmerockyfiles/argusapi/blob/main/src/errors.js): `src/errors.js`

### SDN Data

- [Memory Store](https://github.com/itsmerockyfiles/argusapi/blob/main/src/store.js): `src/store.js`
- **SDN Dataset**
- [Feed Builder](https://github.com/itsmerockyfiles/argusapi/blob/main/scripts/build-sdn.js): `scripts/build-sdn.js`

### Other components

- **API Client**
- **OFAC Feed**

## Connections

- API Client → Express API: sends requests
- API Entry → Express API: exports app
- Express API → Proxy Auth: guards routes
- Express API → Screening Engine: screens query
- Screening Engine → Input Errors: throws errors
- Screening Engine → Memory Store: reads entries
- Express API → Memory Store: reads stats and records
- Express API → Feed Builder: triggers rebuild
- Express API → Memory Store: reloads data
- Feed Builder → OFAC Feed: downloads XML
- Feed Builder → SDN Dataset: writes dataset
- Memory Store → SDN Dataset: loads dataset
- Express API → Structured Logger: logs requests and errors
