# nezort11/curl-impersonate-server architecture

> Architecture diagram of the GitHub repository nezort11/curl-impersonate-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nezort11/curl-impersonate-server
- Repository: https://github.com/nezort11/curl-impersonate-server

## Overview

##### Project Type Analysis
This is a specialized proxy server application that:
- Uses serverless architecture
- Implements Docker containerization
- Utilizes Express.js framework
- Incorporates curl-impersonate for TLS fingerprinting bypass
- Runs on Yandex Cloud container registry

##### Main Components

A. Client Layer:
- External clients making HTTP requests
- Supported browsers being impersonated

B. Serverless Container Layer:
- Docker container running on Yandex Cloud
- Express.js server instance
- curl-impersonate implementation

C. Target Servers Layer:
- Protected websites/services being accessed
- TLS fingerprinting protection systems

**Rectangle: Main components**
**Hexagon: Security/Protection elements**

**Blue: Client components**
**Green: Serverless/Container components**
**Gray: External services**
**Red: Security elements**

##### Component Relationships

**Client Request Flow:**
**Client → Yandex Cloud Endpoint → Docker Container → curl-impersonate → Target Server**

**Response Flow:**
**Target Server → curl-impersonate → Docker Container → Yandex Cloud Endpoint → Client**

##### Key Elements to Highlight

a. Infrastructure Components:
- Yandex Cloud Container Registry
- Docker container runtime
- Express.js server
- curl-impersonate integration

b. Security Features:
- TLS fingerprinting bypass mechanism
- Browser impersonation capabilities

c. Configuration Elements:
- Environment variables (.env.example)
- Docker configuration
- TypeScript configuration

##### Implementation Details

- Request transformation process:
- Original Request → curl-impersonate Wrapper → Modified Request with Browser Fingerprint

- Environment configuration flow:
- .env → src/env.ts → Express Server Configuration

**Top: Client Layer**
**Middle: Serverless Infrastructure**
**Bottom: Target Servers**

##### Important Notes

- Keep the focus on the proxy functionality
- Security bypass mechanism
- Clear request/response paths
- Error handling flows
- Configuration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        C1[External Clients]
        B1[Chrome Browser]
        B2[Firefox Browser]
        B3[Safari Browser]
    end

    subgraph "Serverless Infrastructure"
        YC[Yandex Cloud Container Registry]
        
        subgraph "Docker Container"
            direction TB
            DC[Docker Runtime]:::docker
            EX[Express.js Server]:::server
            CI[curl-impersonate]:::security
            ENV[Environment Config]:::config
            TS[TypeScript Compiler]:::compiler
        end
    end

    subgraph "Target Layer"
        TS1[Protected Websites]
        SEC{TLS Fingerprinting}:::security
    end

    subgraph "Configuration & Scripts"
        direction TB
        CICD[CI/CD Workflow]:::pipeline
        DOCK[Docker Config]:::docker
        ENVF[Env Files]:::config
        SCRIPT[Deployment Scripts]:::script
        TYPES[Type Definitions]:::types
    end

    %% Relationships
    C1 --> YC
    B1 --> YC
    B2 --> YC
    B3 --> YC
    YC --> DC
    DC --> EX
    EX --> CI
    CI --> TS1
    TS1 --- SEC
    SEC -.-> CI
    CI -.-> EX
    EX -.-> DC
    DC -.-> YC
    YC -.-> C1

    %% Configuration Relationships
    CICD --> YC
    DOCK --> DC
    ENVF --> ENV
    SCRIPT --> DC
    TYPES --> TS

    %% Click Events
    click DC "https://github.com/nezort11/curl-impersonate-server/tree/main/Dockerfile"
    click CICD "https://github.com/nezort11/curl-impersonate-server/blob/main/.github/workflows/main.yml"
    click EX "https://github.com/nezort11/curl-impersonate-server/blob/main/src/app.ts"
    click ENV "https://github.com/nezort11/curl-impersonate-server/blob/main/src/env.ts"
    click CI "https://github.com/nezort11/curl-impersonate-server/blob/main/src/types/curl-wrap.d.ts"
    click TS "https://github.com/nezort11/curl-impersonate-server/blob/main/tsconfig.json"
    click SCRIPT "https://github.com/nezort11/curl-impersonate-server/tree/main/scripts"
    click TYPES "https://github.com/nezort11/curl-impersonate-server/tree/main/src/types"
    click ENVF "https://github.com/nezort11/curl-impersonate-server/blob/main/.env.example"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef docker fill:#2496ED,color:white
    classDef server fill:#68A063,color:white
    classDef security fill:#FF6B6B,color:white
    classDef config fill:#4A90E2,color:white
    classDef compiler fill:#007ACC,color:white
    classDef pipeline fill:#2088FF,color:white
    classDef script fill:#F7B93E,color:white
    classDef types fill:#007ACC,color:white

    %% Legend
    subgraph Legend
        L1[Docker Component]:::docker
        L2[Server Component]:::server
        L3[Security Feature]:::security
        L4[Configuration]:::config
        L5[Compiler]:::compiler
        L6[Pipeline]:::pipeline
        L7[Scripts]:::script
        L8[Types]:::types
    end
```
