# ossianaa/node-libcurl architecture

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

- Interactive diagram: https://gitdiagram.com/ossianaa/node-libcurl
- Repository: https://github.com/ossianaa/node-libcurl

## Overview

node-libcurl is a Node.js HTTP client built on a native libcurl binding, with request APIs, browser-style TLS/HTTP fingerprints, and WebSocket support. The main workflow is a caller using `requests` or `fetch`, which configures and sends through `LibCurl`; the native layer performs the transfer and returns response data. Sessions add persistent connection and cookie behavior. The README documents HTTP/2 and HTTP/3 fingerprinting and SOCKS5 UDP proxy support. Some native transfer details and binding-loader wiring were not excerpted, so uncertain links are omitted or marked unverified.

Main entry points: [`src/libcurl.ts`](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl.ts) (LibCurl Client), [`src/libcurl/bao_curl_node_addon.cpp`](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_node_addon.cpp) (Node Native Addon), [`src/fetch.ts`](https://github.com/ossianaa/node-libcurl/blob/master/src/fetch.ts) (Fetch API), [`src/libcurlWebSocket.ts`](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurlWebSocket.ts) (WebSocket Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Request APIs"]
  node_requests["Requests Sessions<br/>[requests.ts]"]
  node_fetch["Fetch API<br/>[fetch.ts]"]
  node_curl["LibCurl Client<br/>[libcurl.ts]"]
end

subgraph group_config["Request Configuration"]
  node_fingerprints["Fingerprint Profiles<br/>[fingerprints.ts]"]
  node_request_utils["Cookie Utilities<br/>[utils.ts]"]
end

subgraph group_native["Native Transfer"]
  node_binding_loader["Binding Loader<br/>[bindings.js]"]
  node_addon["Node Native Addon"]
  node_curl_engine["Curl Transfer Engine<br/>[bao_curl.cpp]"]
  node_multi["Transfer Queue<br/>[bao_curl_multi.cpp]"]
end

subgraph group_websocket["WebSocket"]
  node_websocket_api["WebSocket Client"]
  node_websocket_engine["Native WebSocket"]
end

node_caller(("Application"))
node_remote_server(("HTTP Server"))

node_caller -->|"calls"| node_requests
node_caller -->|"calls"| node_fetch
node_caller -->|"opens"| node_websocket_api
node_requests -->|"configures and sends"| node_curl
node_fetch -->|"configures and sends"| node_curl
node_fetch -->|"sets cookies"| node_request_utils
node_curl -->|"applies profiles"| node_fingerprints
node_curl -->|"uses binding"| node_binding_loader
node_binding_loader -.->|"loads native code"| node_addon
node_addon -->|"uses transfer API"| node_curl_engine
node_addon -->|"queues transfer"| node_multi
node_curl_engine -.->|"transfers requests"| node_remote_server
node_websocket_api -->|"uses client"| node_curl
node_websocket_api -->|"opens and sends"| node_websocket_engine
node_addon -->|"wraps WebSocket"| node_websocket_engine

click node_requests "https://github.com/ossianaa/node-libcurl/blob/master/src/requests.ts"
click node_fetch "https://github.com/ossianaa/node-libcurl/blob/master/src/fetch.ts"
click node_curl "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl.ts"
click node_fingerprints "https://github.com/ossianaa/node-libcurl/blob/master/src/fingerprints.ts"
click node_request_utils "https://github.com/ossianaa/node-libcurl/blob/master/src/utils.ts"
click node_binding_loader "https://github.com/ossianaa/node-libcurl/blob/master/scripts/bindings.js"
click node_addon "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_node_addon.cpp"
click node_curl_engine "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl.cpp"
click node_multi "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_multi.cpp"
click node_websocket_api "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurlWebSocket.ts"
click node_websocket_engine "https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_websocket.cpp"

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_requests,node_fetch,node_curl toneBlue
class node_fingerprints,node_request_utils toneAmber
class node_binding_loader,node_addon,node_curl_engine,node_multi,node_remote_server toneMint
class node_websocket_api,node_websocket_engine toneRose
class node_caller toneIndigo
```

## Components

### Request APIs

- [Requests Sessions](https://github.com/ossianaa/node-libcurl/blob/master/src/requests.ts): `src/requests.ts`
- [Fetch API](https://github.com/ossianaa/node-libcurl/blob/master/src/fetch.ts): `src/fetch.ts`
- [LibCurl Client](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl.ts): `src/libcurl.ts`

### Request Configuration

- [Fingerprint Profiles](https://github.com/ossianaa/node-libcurl/blob/master/src/fingerprints.ts): `src/fingerprints.ts`
- [Cookie Utilities](https://github.com/ossianaa/node-libcurl/blob/master/src/utils.ts): `src/utils.ts`

### Native Transfer

- [Binding Loader](https://github.com/ossianaa/node-libcurl/blob/master/scripts/bindings.js): `scripts/bindings.js`
- [Node Native Addon](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_node_addon.cpp): `src/libcurl/bao_curl_node_addon.cpp`
- [Curl Transfer Engine](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl.cpp): `src/libcurl/bao_curl.cpp`
- [Transfer Queue](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_multi.cpp): `src/libcurl/bao_curl_multi.cpp`

### WebSocket

- [WebSocket Client](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurlWebSocket.ts): `src/libcurlWebSocket.ts`
- [Native WebSocket](https://github.com/ossianaa/node-libcurl/blob/master/src/libcurl/bao_curl_websocket.cpp): `src/libcurl/bao_curl_websocket.cpp`

### Other components

- **Application**
- **HTTP Server**

## Connections

- Application → Requests Sessions: calls
- Application → Fetch API: calls
- Application → WebSocket Client: opens
- Requests Sessions → LibCurl Client: configures and sends (evidence: `src/requests.ts`)
- Fetch API → LibCurl Client: configures and sends (evidence: `src/fetch.ts`)
- Fetch API → Cookie Utilities: sets cookies (evidence: `src/fetch.ts`)
- LibCurl Client → Fingerprint Profiles: applies profiles (evidence: `src/libcurl.ts`)
- LibCurl Client → Binding Loader: uses binding (evidence: `src/libcurl.ts`)
- Binding Loader → Node Native Addon: loads native code
- Node Native Addon → Curl Transfer Engine: uses transfer API (evidence: `src/libcurl/bao_curl_node_addon.cpp`)
- Node Native Addon → Transfer Queue: queues transfer (evidence: `src/libcurl/bao_curl_node_addon.cpp`)
- Curl Transfer Engine → HTTP Server: transfers requests
- WebSocket Client → LibCurl Client: uses client (evidence: `src/libcurlWebSocket.ts`)
- WebSocket Client → Native WebSocket: opens and sends (evidence: `src/libcurlWebSocket.ts`)
- Node Native Addon → Native WebSocket: wraps WebSocket (evidence: `src/libcurl/bao_curl_node_addon.cpp`)
