# iruko233/turnstile-slip architecture

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

- Interactive diagram: https://gitdiagram.com/iruko233/turnstile-slip
- Repository: https://github.com/iruko233/turnstile-slip

## Overview

#### Purpose and Entry Point
Turnstile-Slip is a local Node.js HTTP service that automates Cloudflare Turnstile completion and returns a target page’s `cf_clearance` cookie. The executable service and likely all orchestration logic are in `captchaSolver.js`; runtime dependencies and scripts are defined in `package.json`.

#### Public API Boundary
The service listens locally on port 3000 and exposes `GET /api`. Requests supply a required target URL plus optional `fast`, `proxy`, and `ua` query parameters. The HTTP layer is implemented in `captchaSolver.js`; callers receive page title, effective User-Agent, and clearance cookie rather than direct browser control.

#### Browser-Automation Pipeline
For each API request, the solver creates/configures an automated browser environment, navigates to the target, and waits for Turnstile verification to establish `cf_clearance`. This central lifecycle—from browser launch through result collection and teardown—belongs to `captchaSolver.js`.

#### Environment Fingerprint Configuration
Optional `ua` input drives browser identity alignment: OS/platform and Chrome major version are inferred from the supplied User-Agent. Optional HTTP/SOCKS5 `proxy` routes browser traffic; proxy geolocation is used to synchronize browser locale and timezone. These anti-fingerprinting controls are part of the request-to-browser configuration boundary in `captchaSolver.js`.

#### Completion Detection and Response Modes
Normal mode waits for the standard automation flow to finish. Fast mode periodically reads browser cookie state and returns immediately when `cf_clearance` appears, reducing API latency. Cookie polling, result extraction, and response serialization are handled by `captchaSolver.js`.

#### Runtime and External Dependencies
The system runs on Node.js and requires packages installed via npm (`package.json`, `package-lock.json`). It interacts with arbitrary target sites protected by Cloudflare Turnstile, optional upstream proxy servers, and a GeoIP data/service dependency implied by proxy-location resolution. Demo images are stored under `assets/`.

Main entry points: [`captchaSolver.js`](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js) (Browser lifecycle), [`package.json`](https://github.com/iruko233/turnstile-slip/blob/main/package.json) (npm dependencies), [`package-lock.json`](https://github.com/iruko233/turnstile-slip/blob/main/package-lock.json) (Dependency lockfile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Local solver service"]
  node_api["GET /api<br/>HTTP endpoint<br/>[captchaSolver.js]"]
  node_request_config["Request configuration<br/>solver config<br/>[captchaSolver.js]"]
  node_fingerprint["Fingerprint alignment<br/>browser identity<br/>[captchaSolver.js]"]
  node_browser_lifecycle{{"Browser lifecycle<br/>automation orchestration<br/>[captchaSolver.js]"}}
  node_turnstile_wait["Turnstile completion<br/>verification wait<br/>[captchaSolver.js]"]
  node_fast_polling["Fast cookie polling<br/>completion detector<br/>[captchaSolver.js]"]
  node_result_response["Result response<br/>response serializer<br/>[captchaSolver.js]"]
  node_node_runtime["Node.js runtime"]
  node_npm_dependencies["npm dependencies<br/>package manifest<br/>[package.json]"]
  node_lockfile["Dependency lockfile<br/>[package-lock.json]"]
end

subgraph group_external["External systems"]
  node_target_site["Target site<br/>Cloudflare-protected site"]
  node_proxy["Upstream proxy<br/>HTTP/SOCKS5 proxy"]
  node_geoip["Proxy GeoIP<br/>geolocation dependency"]
end

node_client(("API caller<br/>client"))

node_client -->|"GET request"| node_api
node_api -->|"validates options"| node_request_config
node_request_config -->|"ua and proxy settings"| node_fingerprint
node_request_config -->|"launch configuration"| node_browser_lifecycle
node_fingerprint -->|"identity settings"| node_browser_lifecycle
node_browser_lifecycle -->|"navigates to target"| node_target_site
node_browser_lifecycle -.->|"routes traffic when supplied"| node_proxy
node_proxy -.->|"location lookup"| node_geoip
node_geoip -->|"locale and timezone"| node_fingerprint
node_browser_lifecycle -->|"normal mode"| node_turnstile_wait
node_browser_lifecycle -->|"fast mode"| node_fast_polling
node_turnstile_wait -->|"clearance established"| node_result_response
node_fast_polling -->|"cf_clearance found"| node_result_response
node_result_response -->|"title, UA, cookie"| node_client
node_node_runtime -->|"runs service"| node_api
node_npm_dependencies -->|"installs runtime packages"| node_node_runtime
node_lockfile -->|"pins dependency resolution"| node_npm_dependencies

click node_api "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_request_config "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_fingerprint "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_browser_lifecycle "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_turnstile_wait "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_fast_polling "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_result_response "https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js"
click node_npm_dependencies "https://github.com/iruko233/turnstile-slip/blob/main/package.json"
click node_lockfile "https://github.com/iruko233/turnstile-slip/blob/main/package-lock.json"

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_api,node_request_config,node_fingerprint,node_browser_lifecycle,node_turnstile_wait,node_fast_polling,node_result_response,node_node_runtime,node_npm_dependencies,node_lockfile toneBlue
class node_target_site,node_proxy,node_geoip toneAmber
class node_client toneNeutral
```

## Components

### Local solver service

- [GET /api](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): HTTP endpoint · Accepts target URL plus fast, proxy, and ua options. · `captchaSolver.js`
- [Request configuration](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): solver config · Builds browser settings from URL, User-Agent, and proxy inputs. · `captchaSolver.js`
- [Fingerprint alignment](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): browser identity · Infers platform and Chrome version; aligns locale and timezone. · `captchaSolver.js`
- [Browser lifecycle](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): automation orchestration · Launches, navigates, collects results, and tears down the browser. · `captchaSolver.js`
- [Turnstile completion](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): verification wait · Waits for the target page to establish clearance. · `captchaSolver.js`
- [Fast cookie polling](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): completion detector · Periodically checks cookies and exits when cf_clearance appears. · `captchaSolver.js`
- [Result response](https://github.com/iruko233/turnstile-slip/blob/main/captchaSolver.js): response serializer · Returns title, effective User-Agent, and cf_clearance. · `captchaSolver.js`
- **Node.js runtime**: runtime
- [npm dependencies](https://github.com/iruko233/turnstile-slip/blob/main/package.json): package manifest · Defines installed runtime packages and scripts. · `package.json`
- [Dependency lockfile](https://github.com/iruko233/turnstile-slip/blob/main/package-lock.json): lockfile · `package-lock.json`

### External systems

- **Target site**: Cloudflare-protected site · Arbitrary target page protected by Turnstile.
- **Upstream proxy**: HTTP/SOCKS5 proxy
- **Proxy GeoIP**: geolocation dependency · Supplies proxy location for locale and timezone synchronization.

### Other components

- **API caller**: client

## Connections

- API caller → GET /api: GET request
- GET /api → Request configuration: validates options
- Request configuration → Fingerprint alignment: ua and proxy settings
- Request configuration → Browser lifecycle: launch configuration
- Fingerprint alignment → Browser lifecycle: identity settings
- Browser lifecycle → Target site: navigates to target
- Browser lifecycle → Upstream proxy: routes traffic when supplied
- Upstream proxy → Proxy GeoIP: location lookup
- Proxy GeoIP → Fingerprint alignment: locale and timezone
- Browser lifecycle → Turnstile completion: normal mode
- Browser lifecycle → Fast cookie polling: fast mode
- Turnstile completion → Result response: clearance established
- Fast cookie polling → Result response: cf_clearance found
- Result response → API caller: title, UA, cookie
- Node.js runtime → GET /api: runs service
- npm dependencies → Node.js runtime: installs runtime packages
- Dependency lockfile → npm dependencies: pins dependency resolution
