# prateek-chaubey/websafe architecture

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

- Interactive diagram: https://gitdiagram.com/prateek-chaubey/websafe
- Repository: https://github.com/prateek-chaubey/websafe

## Overview

SaferWeb is an Express URL-security service with a browser-served page and three documented capabilities: URL threat checks, screenshot capture, and proxified browsing. The main workflow checks a URL, follows its redirects, and submits the final URL to Google Safe Browsing; the same service also offers screenshot and proxy endpoints. The README documents URL expansion and redirect tracking, but no separate expansion endpoint appears in the sampled runtime. The graph is based on the README and index.js; unsampled page behavior is not inferred.

Main entry points: [`index.js`](https://github.com/prateek-chaubey/websafe/blob/main/index.js) (Express server), [`index.html`](https://github.com/prateek-chaubey/websafe/blob/main/index.html) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP service"]
  node_server["Express server<br/>[index.js]"]
  node_webpage["Web interface<br/>[index.html]"]
end

subgraph group_security["URL security"]
  node_safety["Safety endpoint<br/>[index.js]"]
  node_redirects["Redirect resolution<br/>[index.js]"]
  node_threatcheck["Threat lookup<br/>[index.js]"]
  node_safe_browsing{{"Google Safe Browsing"}}
end

subgraph group_access["Website access"]
  node_screenshot["Screenshot endpoint<br/>[index.js]"]
  node_browser_engine["Headless browser<br/>[index.js]"]
  node_proxy["Proxy endpoint<br/>[index.js]"]
  node_target_site{{"Target website"}}
end

node_user(("Browser user"))

node_user -->|"requests endpoints"| node_server
node_server -->|"serves page"| node_webpage
node_server -->|"routes safety checks"| node_safety
node_server -->|"routes captures"| node_screenshot
node_server -->|"routes proxy access"| node_proxy
node_safety -->|"fetches and follows"| node_redirects
node_safety -->|"checks final URL"| node_threatcheck
node_threatcheck -->|"submits threat query"| node_safe_browsing
node_screenshot -->|"captures page"| node_browser_engine
node_browser_engine -->|"loads page"| node_target_site
node_proxy -->|"forwards requests"| node_target_site

click node_server "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_webpage "https://github.com/prateek-chaubey/websafe/blob/main/index.html"
click node_safety "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_redirects "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_threatcheck "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_screenshot "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_browser_engine "https://github.com/prateek-chaubey/websafe/blob/main/index.js"
click node_proxy "https://github.com/prateek-chaubey/websafe/blob/main/index.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_webpage,node_user toneBlue
class node_safety,node_redirects,node_threatcheck,node_safe_browsing toneAmber
class node_screenshot,node_browser_engine,node_proxy,node_target_site toneMint
```

## Components

### HTTP service

- [Express server](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- [Web interface](https://github.com/prateek-chaubey/websafe/blob/main/index.html): `index.html`

### URL security

- [Safety endpoint](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- [Redirect resolution](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- [Threat lookup](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- **Google Safe Browsing**

### Website access

- [Screenshot endpoint](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- [Headless browser](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- [Proxy endpoint](https://github.com/prateek-chaubey/websafe/blob/main/index.js): `index.js`
- **Target website**

### Other components

- **Browser user**

## Connections

- Browser user → Express server: requests endpoints (evidence: `README.md`)
- Express server → Web interface: serves page (evidence: `index.js`)
- Express server → Safety endpoint: routes safety checks (evidence: `index.js`)
- Express server → Screenshot endpoint: routes captures (evidence: `index.js`)
- Express server → Proxy endpoint: routes proxy access (evidence: `index.js`)
- Safety endpoint → Redirect resolution: fetches and follows (evidence: `index.js`)
- Safety endpoint → Threat lookup: checks final URL (evidence: `index.js`)
- Threat lookup → Google Safe Browsing: submits threat query (evidence: `index.js`)
- Screenshot endpoint → Headless browser: captures page (evidence: `index.js`)
- Headless browser → Target website: loads page (evidence: `index.js`)
- Proxy endpoint → Target website: forwards requests (evidence: `index.js`)
