# techarohq/anubis architecture

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

- Interactive diagram: https://gitdiagram.com/techarohq/anubis
- Repository: https://github.com/techarohq/anubis

## Overview

Anubis is a web firewall that evaluates incoming requests against bot policy and, when needed, requires a browser challenge before allowing traffic to reach protected upstream resources. The main executable configures and starts the server; policy evaluation, challenge handling, and challenge-page code represent distinct runtime stages. The README documents the product flow, while sampled source confirms selected wiring. Several listed core modules and integrations were not sampled, so uncertain connections are omitted.

Main entry points: [`lib/anubis.go`](https://github.com/techarohq/anubis/blob/main/lib/anubis.go) (Request gateway), [`web/js/main.ts`](https://github.com/techarohq/anubis/blob/main/web/js/main.ts) (Browser challenge app), [`lib/policy/policy.go`](https://github.com/techarohq/anubis/blob/main/lib/policy/policy.go) (Bot policy), [`web/js/algorithms/index.ts`](https://github.com/techarohq/anubis/blob/main/web/js/algorithms/index.ts) (Proof algorithms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firewall runtime"]
  node_entry["Anubis executable<br/>[main.go]"]
  node_gateway["Request gateway<br/>[anubis.go]"]
  node_honeypot["Naive honeypot<br/>[naive.go]"]
end

subgraph group_policy["Policy and state"]
  node_policy_engine["Bot policy<br/>[policy.go]"]
  node_config["Policy configuration<br/>[config.go]"]
  node_store[("State store<br/>[interface.go]")]
end

subgraph group_challenge["Challenge experience"]
  node_challenge_logic["Challenge handling<br/>[challenge.go]"]
  node_challenge_page["Challenge page<br/>[index.go]"]
  node_browser_main["Browser challenge app<br/>[main.ts]"]
  node_algorithms["Proof algorithms<br/>[index.ts]"]
  node_fast_algo["Fast algorithm<br/>[fast.ts]"]
  node_wasm_algo["WASM algorithm<br/>[wasm.ts]"]
  node_backoff["Fetch backoff<br/>[backoff.ts]"]
  node_pow_wasm["WASM proof runtime<br/>[wasm.go]"]
  node_xeact["Challenge UI helpers<br/>[xeact.js]"]
end

subgraph group_operations["Operations and integrations"]
  node_dnsbl["DNSBL checks<br/>[dnsbl.go]"]
  node_robots_tool["Robots policy converter<br/>[main.go]"]
  node_windows_service["Windows service setup<br/>[service_windows.go]"]
end

node_visitor(("Browser visitor"))
node_upstream["Protected upstream"]

node_visitor -->|"sends requests"| node_gateway
node_entry -->|"creates server"| node_gateway
node_gateway -.->|"checks policy"| node_policy_engine
node_gateway -.->|"issues challenges"| node_challenge_logic
node_gateway -->|"checks reputation"| node_dnsbl
node_policy_engine -->|"loads settings"| node_config
node_policy_engine -->|"builds backend"| node_store
node_challenge_logic -.->|"renders page"| node_challenge_page
node_challenge_page -.->|"loads app"| node_browser_main
node_browser_main -->|"selects algorithm"| node_algorithms
node_browser_main -->|"fetches with retry"| node_backoff
node_algorithms -->|"exports algorithm"| node_fast_algo
node_algorithms -->|"exports algorithm"| node_wasm_algo
node_wasm_algo -.->|"uses WASM"| node_pow_wasm
node_browser_main -->|"submits response"| node_gateway
node_gateway -->|"forwards allowed traffic"| node_upstream
node_robots_tool -->|"generates policy"| node_config

click node_entry "https://github.com/techarohq/anubis/blob/main/cmd/anubis/main.go"
click node_gateway "https://github.com/techarohq/anubis/blob/main/lib/anubis.go"
click node_policy_engine "https://github.com/techarohq/anubis/blob/main/lib/policy/policy.go"
click node_config "https://github.com/techarohq/anubis/blob/main/lib/config/config.go"
click node_store "https://github.com/techarohq/anubis/blob/main/lib/store/interface.go"
click node_challenge_logic "https://github.com/techarohq/anubis/blob/main/lib/challenge/challenge.go"
click node_challenge_page "https://github.com/techarohq/anubis/blob/main/web/index.go"
click node_browser_main "https://github.com/techarohq/anubis/blob/main/web/js/main.ts"
click node_algorithms "https://github.com/techarohq/anubis/blob/main/web/js/algorithms/index.ts"
click node_fast_algo "https://github.com/techarohq/anubis/blob/main/web/js/algorithms/fast.ts"
click node_wasm_algo "https://github.com/techarohq/anubis/blob/main/web/js/algorithms/wasm.ts"
click node_backoff "https://github.com/techarohq/anubis/blob/main/web/js/lib/backoff.ts"
click node_pow_wasm "https://github.com/techarohq/anubis/blob/main/wasm/wasm.go"
click node_honeypot "https://github.com/techarohq/anubis/blob/main/internal/honeypot/naive/naive.go"
click node_dnsbl "https://github.com/techarohq/anubis/blob/main/internal/dnsbl/dnsbl.go"
click node_robots_tool "https://github.com/techarohq/anubis/blob/main/cmd/robots2policy/main.go"
click node_windows_service "https://github.com/techarohq/anubis/blob/main/cmd/anubis/service_windows.go"
click node_xeact "https://github.com/techarohq/anubis/blob/main/lib/challenge/preact/js/xeact.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_entry,node_gateway,node_honeypot,node_visitor toneBlue
class node_policy_engine,node_config,node_store toneAmber
class node_challenge_logic,node_challenge_page,node_browser_main,node_algorithms,node_fast_algo,node_wasm_algo,node_backoff,node_pow_wasm,node_xeact toneMint
class node_dnsbl,node_robots_tool,node_windows_service toneRose
class node_upstream toneIndigo
```

## Components

### Firewall runtime

- [Anubis executable](https://github.com/techarohq/anubis/blob/main/cmd/anubis/main.go): `cmd/anubis/main.go`
- [Request gateway](https://github.com/techarohq/anubis/blob/main/lib/anubis.go): `lib/anubis.go`
- [Naive honeypot](https://github.com/techarohq/anubis/blob/main/internal/honeypot/naive/naive.go): `internal/honeypot/naive/naive.go`

### Policy and state

- [Bot policy](https://github.com/techarohq/anubis/blob/main/lib/policy/policy.go): `lib/policy/policy.go`
- [Policy configuration](https://github.com/techarohq/anubis/blob/main/lib/config/config.go): `lib/config/config.go`
- [State store](https://github.com/techarohq/anubis/blob/main/lib/store/interface.go): `lib/store/interface.go`

### Challenge experience

- [Challenge handling](https://github.com/techarohq/anubis/blob/main/lib/challenge/challenge.go): `lib/challenge/challenge.go`
- [Challenge page](https://github.com/techarohq/anubis/blob/main/web/index.go): `web/index.go`
- [Browser challenge app](https://github.com/techarohq/anubis/blob/main/web/js/main.ts): `web/js/main.ts`
- [Proof algorithms](https://github.com/techarohq/anubis/blob/main/web/js/algorithms/index.ts): `web/js/algorithms/index.ts`
- [Fast algorithm](https://github.com/techarohq/anubis/blob/main/web/js/algorithms/fast.ts): `web/js/algorithms/fast.ts`
- [WASM algorithm](https://github.com/techarohq/anubis/blob/main/web/js/algorithms/wasm.ts): `web/js/algorithms/wasm.ts`
- [Fetch backoff](https://github.com/techarohq/anubis/blob/main/web/js/lib/backoff.ts): `web/js/lib/backoff.ts`
- [WASM proof runtime](https://github.com/techarohq/anubis/blob/main/wasm/wasm.go): `wasm/wasm.go`
- [Challenge UI helpers](https://github.com/techarohq/anubis/blob/main/lib/challenge/preact/js/xeact.js): `lib/challenge/preact/js/xeact.js`

### Operations and integrations

- [DNSBL checks](https://github.com/techarohq/anubis/blob/main/internal/dnsbl/dnsbl.go): `internal/dnsbl/dnsbl.go`
- [Robots policy converter](https://github.com/techarohq/anubis/blob/main/cmd/robots2policy/main.go): `cmd/robots2policy/main.go`
- [Windows service setup](https://github.com/techarohq/anubis/blob/main/cmd/anubis/service_windows.go): `cmd/anubis/service_windows.go`

### Other components

- **Browser visitor**
- **Protected upstream**

## Connections

- Browser visitor → Request gateway: sends requests (evidence: `README.md`)
- Anubis executable → Request gateway: creates server (evidence: `cmd/anubis/main.go`)
- Request gateway → Bot policy: checks policy
- Request gateway → Challenge handling: issues challenges
- Request gateway → DNSBL checks: checks reputation (evidence: `lib/anubis.go`)
- Bot policy → Policy configuration: loads settings (evidence: `lib/policy/policy.go`)
- Bot policy → State store: builds backend (evidence: `lib/policy/policy.go`)
- Challenge handling → Challenge page: renders page
- Challenge page → Browser challenge app: loads app
- Browser challenge app → Proof algorithms: selects algorithm (evidence: `web/js/main.ts`)
- Browser challenge app → Fetch backoff: fetches with retry (evidence: `web/js/main.ts`)
- Proof algorithms → Fast algorithm: exports algorithm (evidence: `web/js/algorithms/index.ts`)
- Proof algorithms → WASM algorithm: exports algorithm (evidence: `web/js/algorithms/index.ts`)
- WASM algorithm → WASM proof runtime: uses WASM
- Browser challenge app → Request gateway: submits response (evidence: `web/js/main.ts`)
- Request gateway → Protected upstream: forwards allowed traffic (evidence: `README.md`)
- Robots policy converter → Policy configuration: generates policy (evidence: `cmd/robots2policy/main.go`)
