# goodnight000/api-anything architecture

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

- Interactive diagram: https://gitdiagram.com/goodnight000/api-anything
- Repository: https://github.com/goodnight000/api-anything

## Overview

API Anything learns reusable HTTP operations from website traffic, then exposes them to agents and scripts; calls can fall back to browser execution and operations can be repaired after drift. The shared registry distributes sanitized learned operations, while local sessions retain credentials. The README documents the main workflow and product surfaces. Source excerpts and the index support several module relationships, but do not show all runtime call sites, so uncertain links are omitted or dashed.

Main entry points: [`src/execute.ts`](https://github.com/goodnight000/api-anything/blob/main/src/execute.ts) (Operation executor), [`registry/src/worker.ts`](https://github.com/goodnight000/api-anything/blob/main/registry/src/worker.ts) (Catalog service), [`src/cli.ts`](https://github.com/goodnight000/api-anything/blob/main/src/cli.ts) (Command line), [`src/heal.ts`](https://github.com/goodnight000/api-anything/blob/main/src/heal.ts) (Operation repair)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning and repair"]
  node_browser["Learning browser<br/>[browser.ts]"]
  node_learner["Operation learner<br/>[learn.ts]"]
  node_healer["Operation repair<br/>[heal.ts]"]
end

subgraph group_runtime["Operation runtime"]
  node_spec["Operation specs<br/>[spec.ts]"]
  node_executor["Operation executor<br/>[execute.ts]"]
  node_http["HTTP transport<br/>[http.ts]"]
  node_classifier["Response classifier<br/>[classify.ts]"]
  node_extractor["Response extraction<br/>[extract.ts]"]
  node_search["Site search<br/>[search.ts]"]
end

subgraph group_local["Local state and safety"]
  node_localstore[("Operation store<br/>[store.ts]")]
  node_sessions[("Credential sessions<br/>[session.ts]")]
  node_seal["Sealed data<br/>[seal.ts]"]
end

subgraph group_interfaces["Agent interfaces"]
  node_cli["Command line<br/>[cli.ts]"]
  node_mcp["MCP server<br/>[mcp.ts]"]
  node_httpserver["HTTP server<br/>[serve.ts]"]
  node_python["Python client<br/>[client.py]"]
end

subgraph group_registry["Shared catalog"]
  node_registryapi["Registry client<br/>[registry-api.ts]"]
  node_catalog["Catalog service<br/>[worker.ts]"]
  node_catalogstore[("Catalog database<br/>[store.ts]")]
  node_catalogrules["Catalog rules<br/>[rules.ts]"]
  node_registrypages["Catalog browsing<br/>[pages.ts]"]
end

node_agent(("Agent or user"))
node_website{{"Target website"}}

node_agent -->|"invokes"| node_cli
node_agent -->|"invokes"| node_mcp
node_agent -->|"invokes"| node_httpserver
node_agent -->|"calls through"| node_python
node_cli -.->|"finds operations"| node_search
node_cli -.->|"calls operations"| node_executor
node_mcp -->|"calls operations"| node_executor
node_httpserver -->|"serves operations"| node_executor
node_python -.->|"sends requests"| node_httpserver
node_executor -.->|"sends requests"| node_http
node_http -->|"requests data"| node_website
node_website -->|"returns responses"| node_http
node_executor -->|"falls back to"| node_browser
node_browser -->|"loads pages"| node_website
node_executor -.->|"classifies responses"| node_classifier
node_classifier -->|"extracts data"| node_extractor
node_learner -->|"learns from"| node_browser
node_learner -->|"produces operations"| node_spec
node_healer -->|"re-learns"| node_learner
node_healer -->|"replays operation"| node_executor
node_healer -.->|"saves repair"| node_localstore
node_executor -.->|"loads operations"| node_localstore
node_executor -.->|"uses credentials"| node_sessions
node_sessions -->|"seals session data"| node_seal
node_cli -.->|"syncs operations"| node_registryapi
node_registryapi -->|"accesses catalog"| node_catalog
node_catalog -.->|"stores catalog data"| node_catalogstore
node_catalog -.->|"applies rules"| node_catalogrules
node_catalog -.->|"serves browsing"| node_registrypages
node_catalog -->|"shares operations"| node_agent

click node_browser "https://github.com/goodnight000/api-anything/blob/main/src/browser.ts"
click node_learner "https://github.com/goodnight000/api-anything/blob/main/src/learn.ts"
click node_healer "https://github.com/goodnight000/api-anything/blob/main/src/heal.ts"
click node_spec "https://github.com/goodnight000/api-anything/blob/main/src/spec.ts"
click node_executor "https://github.com/goodnight000/api-anything/blob/main/src/execute.ts"
click node_http "https://github.com/goodnight000/api-anything/blob/main/src/http.ts"
click node_classifier "https://github.com/goodnight000/api-anything/blob/main/src/classify.ts"
click node_extractor "https://github.com/goodnight000/api-anything/blob/main/src/extract.ts"
click node_search "https://github.com/goodnight000/api-anything/blob/main/src/search.ts"
click node_localstore "https://github.com/goodnight000/api-anything/blob/main/src/store.ts"
click node_sessions "https://github.com/goodnight000/api-anything/blob/main/src/session.ts"
click node_seal "https://github.com/goodnight000/api-anything/blob/main/src/seal.ts"
click node_cli "https://github.com/goodnight000/api-anything/blob/main/src/cli.ts"
click node_mcp "https://github.com/goodnight000/api-anything/blob/main/src/mcp.ts"
click node_httpserver "https://github.com/goodnight000/api-anything/blob/main/src/serve.ts"
click node_python "https://github.com/goodnight000/api-anything/blob/main/python/src/api_anything/client.py"
click node_registryapi "https://github.com/goodnight000/api-anything/blob/main/src/registry-api.ts"
click node_catalog "https://github.com/goodnight000/api-anything/blob/main/registry/src/worker.ts"
click node_catalogstore "https://github.com/goodnight000/api-anything/blob/main/registry/src/store.ts"
click node_catalogrules "https://github.com/goodnight000/api-anything/blob/main/registry/src/rules.ts"
click node_registrypages "https://github.com/goodnight000/api-anything/blob/main/registry/src/pages.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_browser,node_learner,node_healer,node_agent toneBlue
class node_spec,node_executor,node_http,node_classifier,node_extractor,node_search toneAmber
class node_localstore,node_sessions,node_seal toneMint
class node_cli,node_mcp,node_httpserver,node_python toneRose
class node_registryapi,node_catalog,node_catalogstore,node_catalogrules,node_registrypages,node_website toneIndigo
```

## Components

### Learning and repair

- [Learning browser](https://github.com/goodnight000/api-anything/blob/main/src/browser.ts): `src/browser.ts`
- [Operation learner](https://github.com/goodnight000/api-anything/blob/main/src/learn.ts): `src/learn.ts`
- [Operation repair](https://github.com/goodnight000/api-anything/blob/main/src/heal.ts): `src/heal.ts`

### Operation runtime

- [Operation specs](https://github.com/goodnight000/api-anything/blob/main/src/spec.ts): `src/spec.ts`
- [Operation executor](https://github.com/goodnight000/api-anything/blob/main/src/execute.ts): `src/execute.ts`
- [HTTP transport](https://github.com/goodnight000/api-anything/blob/main/src/http.ts): `src/http.ts`
- [Response classifier](https://github.com/goodnight000/api-anything/blob/main/src/classify.ts): `src/classify.ts`
- [Response extraction](https://github.com/goodnight000/api-anything/blob/main/src/extract.ts): `src/extract.ts`
- [Site search](https://github.com/goodnight000/api-anything/blob/main/src/search.ts): `src/search.ts`

### Local state and safety

- [Operation store](https://github.com/goodnight000/api-anything/blob/main/src/store.ts): `src/store.ts`
- [Credential sessions](https://github.com/goodnight000/api-anything/blob/main/src/session.ts): `src/session.ts`
- [Sealed data](https://github.com/goodnight000/api-anything/blob/main/src/seal.ts): `src/seal.ts`

### Agent interfaces

- [Command line](https://github.com/goodnight000/api-anything/blob/main/src/cli.ts): `src/cli.ts`
- [MCP server](https://github.com/goodnight000/api-anything/blob/main/src/mcp.ts): `src/mcp.ts`
- [HTTP server](https://github.com/goodnight000/api-anything/blob/main/src/serve.ts): `src/serve.ts`
- [Python client](https://github.com/goodnight000/api-anything/blob/main/python/src/api_anything/client.py): `python/src/api_anything/client.py`

### Shared catalog

- [Registry client](https://github.com/goodnight000/api-anything/blob/main/src/registry-api.ts): `src/registry-api.ts`
- [Catalog service](https://github.com/goodnight000/api-anything/blob/main/registry/src/worker.ts): `registry/src/worker.ts`
- [Catalog database](https://github.com/goodnight000/api-anything/blob/main/registry/src/store.ts): `registry/src/store.ts`
- [Catalog rules](https://github.com/goodnight000/api-anything/blob/main/registry/src/rules.ts): `registry/src/rules.ts`
- [Catalog browsing](https://github.com/goodnight000/api-anything/blob/main/registry/src/pages.ts): `registry/src/pages.ts`

### Other components

- **Agent or user**
- **Target website**

## Connections

- Agent or user → Command line: invokes
- Agent or user → MCP server: invokes
- Agent or user → HTTP server: invokes
- Agent or user → Python client: calls through
- Command line → Site search: finds operations
- Command line → Operation executor: calls operations (evidence: `src/cli.ts`)
- MCP server → Operation executor: calls operations
- HTTP server → Operation executor: serves operations
- Python client → HTTP server: sends requests
- Operation executor → HTTP transport: sends requests (evidence: `src/execute.ts`)
- HTTP transport → Target website: requests data
- Target website → HTTP transport: returns responses
- Operation executor → Learning browser: falls back to (evidence: `src/execute.ts`)
- Learning browser → Target website: loads pages
- Operation executor → Response classifier: classifies responses (evidence: `src/execute.ts`)
- Response classifier → Response extraction: extracts data (evidence: `src/classify.ts`)
- Operation learner → Learning browser: learns from
- Operation learner → Operation specs: produces operations (evidence: `src/learn.ts`)
- Operation repair → Operation learner: re-learns (evidence: `src/heal.ts`)
- Operation repair → Operation executor: replays operation (evidence: `src/heal.ts`)
- Operation repair → Operation store: saves repair (evidence: `src/heal.ts`)
- Operation executor → Operation store: loads operations (evidence: `src/execute.ts`)
- Operation executor → Credential sessions: uses credentials (evidence: `src/execute.ts`)
- Credential sessions → Sealed data: seals session data (evidence: `src/session.ts`)
- Command line → Registry client: syncs operations
- Registry client → Catalog service: accesses catalog (evidence: `registry/src/worker.ts`)
- Catalog service → Catalog database: stores catalog data (evidence: `registry/src/worker.ts`)
- Catalog service → Catalog rules: applies rules (evidence: `registry/src/worker.ts`)
- Catalog service → Catalog browsing: serves browsing (evidence: `registry/src/worker.ts`)
- Catalog service → Agent or user: shares operations
