# 7sageer/sublink-worker architecture

> Architecture diagram of the GitHub repository 7sageer/sublink-worker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/7sageer/sublink-worker
- Repository: https://github.com/7sageer/sublink-worker

## Overview

Sublink Worker is a web-based proxy subscription manager and converter. Its main user workflow takes share links or complete client configs, parses them into proxy data, applies client-specific configuration and rules, then presents subscription links. The README also documents saved configs, short links, an automation API, and multiple deployment runtimes. The sampled sources establish parser behavior, storage operations, and runtime entry points; the application routes and UI-to-service wiring were not sampled, so those relationships are shown only where supported.

Main entry points: [`src/parsers/subscription/httpSubscriptionFetcher.js`](https://github.com/7sageer/sublink-worker/blob/main/src/parsers/subscription/httpSubscriptionFetcher.js) (HTTP Fetcher), [`src/adapters/kv`](https://github.com/7sageer/sublink-worker/tree/main/src/adapters/kv) (KV Adapters), [`src/app/createApp.jsx`](https://github.com/7sageer/sublink-worker/blob/main/src/app/createApp.jsx) (Application), [`src/runtime/runtimeConfig.js`](https://github.com/7sageer/sublink-worker/blob/main/src/runtime/runtimeConfig.js) (Runtime Config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web and API"]
  node_web_ui["Web Interface<br/>[Form.jsx]"]
  node_api["Automation API<br/>[createApp.jsx]"]
  node_app["Application<br/>[createApp.jsx]"]
end

subgraph group_conversion["Parsing and Conversion"]
  node_proxy_parser["Proxy Parser<br/>[ProxyParser.js]"]
  node_protocol_parsers["Protocol Parsers"]
  node_subscription_fetcher["HTTP Fetcher"]
  node_content_parser["Content Parser"]
  node_surge_parser["Surge INI Parser"]
end

subgraph group_configuration["Config and Rules"]
  node_builders["Client Builders"]
  node_rules["Rules and Presets"]
end

subgraph group_services["Persistence and Links"]
  node_config_storage["Config Storage"]
  node_short_links["Short Links"]
  node_kv_adapters["KV Adapters"]
end

subgraph group_deployment["Runtime Adapters"]
  node_worker["Worker Entry<br/>[worker.jsx]"]
  node_vercel["Vercel Adapter<br/>[vercel.js]"]
  node_node_runtime["Node Adapter<br/>[node.js]"]
  node_runtime_config["Runtime Config<br/>[runtimeConfig.js]"]
end

node_user(("User"))
node_subscription_source(("Subscription Sources"))
node_kv_service[("KV Provider")]

node_user -->|"uses"| node_web_ui
node_user -.->|"requests"| node_api
node_worker -->|"dispatches"| node_app
node_vercel -->|"dispatches"| node_app
node_node_runtime -->|"serves"| node_app
node_worker -->|"configures"| node_runtime_config
node_vercel -->|"configures"| node_runtime_config
node_node_runtime -->|"configures"| node_runtime_config
node_subscription_source -->|"provides content"| node_subscription_fetcher
node_proxy_parser -->|"dispatches"| node_protocol_parsers
node_proxy_parser -->|"fetches HTTP"| node_subscription_fetcher
node_subscription_fetcher -->|"parses content"| node_content_parser
node_content_parser -->|"converts INI"| node_surge_parser
node_builders -->|"uses settings"| node_rules
node_config_storage -->|"uses store"| node_kv_adapters
node_short_links -->|"uses store"| node_kv_adapters
node_kv_adapters -->|"reads and writes"| node_kv_service

click node_web_ui "https://github.com/7sageer/sublink-worker/blob/main/src/components/Form.jsx"
click node_api "https://github.com/7sageer/sublink-worker/blob/main/src/app/createApp.jsx"
click node_app "https://github.com/7sageer/sublink-worker/blob/main/src/app/createApp.jsx"
click node_worker "https://github.com/7sageer/sublink-worker/blob/main/src/worker.jsx"
click node_vercel "https://github.com/7sageer/sublink-worker/blob/main/src/runtime/vercel.js"
click node_node_runtime "https://github.com/7sageer/sublink-worker/blob/main/src/runtime/node.js"
click node_runtime_config "https://github.com/7sageer/sublink-worker/blob/main/src/runtime/runtimeConfig.js"
click node_proxy_parser "https://github.com/7sageer/sublink-worker/blob/main/src/parsers/ProxyParser.js"
click node_protocol_parsers "https://github.com/7sageer/sublink-worker/tree/main/src/parsers/protocols"
click node_subscription_fetcher "https://github.com/7sageer/sublink-worker/blob/main/src/parsers/subscription/httpSubscriptionFetcher.js"
click node_content_parser "https://github.com/7sageer/sublink-worker/blob/main/src/parsers/subscription/subscriptionContentParser.js"
click node_surge_parser "https://github.com/7sageer/sublink-worker/blob/main/src/utils/surgeConfigParser.js"
click node_builders "https://github.com/7sageer/sublink-worker/tree/main/src/builders"
click node_rules "https://github.com/7sageer/sublink-worker/tree/main/src/config"
click node_config_storage "https://github.com/7sageer/sublink-worker/blob/main/src/services/configStorageService.js"
click node_short_links "https://github.com/7sageer/sublink-worker/blob/main/src/services/shortLinkService.js"
click node_kv_adapters "https://github.com/7sageer/sublink-worker/tree/main/src/adapters/kv"

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_web_ui,node_api,node_app,node_user toneBlue
class node_proxy_parser,node_protocol_parsers,node_subscription_fetcher,node_content_parser,node_surge_parser,node_kv_service toneAmber
class node_builders,node_rules toneMint
class node_config_storage,node_short_links,node_kv_adapters toneRose
class node_worker,node_vercel,node_node_runtime,node_runtime_config,node_subscription_source toneIndigo
```

## Components

### Web and API

- [Web Interface](https://github.com/7sageer/sublink-worker/blob/main/src/components/Form.jsx): `src/components/Form.jsx`
- [Automation API](https://github.com/7sageer/sublink-worker/blob/main/src/app/createApp.jsx): `src/app/createApp.jsx`
- [Application](https://github.com/7sageer/sublink-worker/blob/main/src/app/createApp.jsx): `src/app/createApp.jsx`

### Parsing and Conversion

- [Proxy Parser](https://github.com/7sageer/sublink-worker/blob/main/src/parsers/ProxyParser.js): `src/parsers/ProxyParser.js`
- [Protocol Parsers](https://github.com/7sageer/sublink-worker/tree/main/src/parsers/protocols): `src/parsers/protocols`
- [HTTP Fetcher](https://github.com/7sageer/sublink-worker/blob/main/src/parsers/subscription/httpSubscriptionFetcher.js): `src/parsers/subscription/httpSubscriptionFetcher.js`
- [Content Parser](https://github.com/7sageer/sublink-worker/blob/main/src/parsers/subscription/subscriptionContentParser.js): `src/parsers/subscription/subscriptionContentParser.js`
- [Surge INI Parser](https://github.com/7sageer/sublink-worker/blob/main/src/utils/surgeConfigParser.js): `src/utils/surgeConfigParser.js`

### Config and Rules

- [Client Builders](https://github.com/7sageer/sublink-worker/tree/main/src/builders): `src/builders`
- [Rules and Presets](https://github.com/7sageer/sublink-worker/tree/main/src/config): `src/config`

### Persistence and Links

- [Config Storage](https://github.com/7sageer/sublink-worker/blob/main/src/services/configStorageService.js): `src/services/configStorageService.js`
- [Short Links](https://github.com/7sageer/sublink-worker/blob/main/src/services/shortLinkService.js): `src/services/shortLinkService.js`
- [KV Adapters](https://github.com/7sageer/sublink-worker/tree/main/src/adapters/kv): `src/adapters/kv`

### Runtime Adapters

- [Worker Entry](https://github.com/7sageer/sublink-worker/blob/main/src/worker.jsx): `src/worker.jsx`
- [Vercel Adapter](https://github.com/7sageer/sublink-worker/blob/main/src/runtime/vercel.js): `src/runtime/vercel.js`
- [Node Adapter](https://github.com/7sageer/sublink-worker/blob/main/src/runtime/node.js): `src/runtime/node.js`
- [Runtime Config](https://github.com/7sageer/sublink-worker/blob/main/src/runtime/runtimeConfig.js): `src/runtime/runtimeConfig.js`

### Other components

- **User**
- **Subscription Sources**
- **KV Provider**

## Connections

- User → Web Interface: uses
- User → Automation API: requests
- Worker Entry → Application: dispatches
- Vercel Adapter → Application: dispatches
- Node Adapter → Application: serves
- Worker Entry → Runtime Config: configures
- Vercel Adapter → Runtime Config: configures
- Node Adapter → Runtime Config: configures
- Subscription Sources → HTTP Fetcher: provides content
- Proxy Parser → Protocol Parsers: dispatches
- Proxy Parser → HTTP Fetcher: fetches HTTP
- HTTP Fetcher → Content Parser: parses content
- Content Parser → Surge INI Parser: converts INI
- Client Builders → Rules and Presets: uses settings
- Config Storage → KV Adapters: uses store
- Short Links → KV Adapters: uses store
- KV Adapters → KV Provider: reads and writes
