Skip to content

welcome



⏱️ 7 min · Level: Beginner

Harmony is a single-file Cloudflare Worker that generates VLESS proxy subscription links with automatically injected clean Cloudflare IP addresses. When a client requests your worker URL, Harmony dynamically fetches fresh clean IPs from multiple sources, builds fully-formed VLESS configurations across TLS and non-TLS transport groups, and returns a base64-encoded subscription β€” ready to paste into any sing-box or Xray-core client. The entire system runs at the edge with zero infrastructure, zero cold starts, and a 3-second timeout guarantee on all external fetches.

Project Structure ​

The repository is intentionally minimal β€” one worker script, one IP data file, and a VitePress documentation site. There are no build steps for the worker itself; it deploys directly to Cloudflare.

text
Harmony/
β”œβ”€β”€ worker.js          ← The entire application (subscription generator)
β”œβ”€β”€ cf-clean.json      ← Pre-compiled clean IP database (~18K lines)
β”œβ”€β”€ package.json       ← VitePress docs tooling only
β”œβ”€β”€ LICENSE            ← MIT License
β”œβ”€β”€ README.md          ← Persian-language setup guide
└── docs/              ← This documentation site (VitePress)
    β”œβ”€β”€ index.md
    β”œβ”€β”€ en/1-overview.md
    β”œβ”€β”€ en/2-quick-start.md
    β”œβ”€β”€ en/.
    β”œβ”€β”€ en/.
    β”œβ”€β”€ en/.
    β”œβ”€β”€ en/16-fingerprint-and-early-data.md
    β”œβ”€β”€ en/17-cf-clean-json-reference.md
    └── public/
        β”œβ”€β”€ Harmony.svg
        └── logo.svg

runtime dependencies

The worker has zero runtime dependencies β€” no node_modules, no bundler, no framework. You copy worker.js into the Cloudflare dashboard editor and deploy. That's it.

Architecture Overview ​

Harmony follows a fetch β†’ resolve β†’ build β†’ encode pipeline. Every client request triggers the full pipeline from scratch, ensuring IPs are always fresh on each subscription update.

Core Components ​

Despite being a single file, worker.js contains four logically distinct subsystems. Understanding each one is the key to customizing Harmony effectively.

1. Configuration Layer (USER_SETTINGS) ​

The USER_SETTINGS object at the top of the file is the single source of truth for all runtime behavior. It defines your UUID, the number of IPs per group, early-data parameters, and an array of configuration groups β€” each group producing ipCount VLESS links with its own transport, TLS, and IP source settings.

PropertyLocationPurpose
uuidLine 32Your VLESS authentication UUID β€” must match your backend proxy
ipCountLine 35Number of configs generated per group (default: 10)
ed / ehLines 38–39Early data size and header name for WebSocket optimization
groups[]Lines 51–94Array of configuration groups (TLS, TCP, Emergency)

2. IP Data Pipeline ​

Harmony draws clean IPs from three independent sources, shuffled and deduplicated per request. This layered approach provides resilience: if one source is unreachable, the others still populate their groups.

Source KeyOriginDescriptionFailure Mode
dynamic1NiREvil's GitHub repoScanned every 6 hours by an automated IP scannerReturns [] on timeout
dynamic2Strawberry API (strawberry.victoriacross.ir)Aggregates IPs from multiple upstream feedsReturns [] on timeout
staticHardcoded in worker.js (lines 102–971)~870 IPv6-mapped and plain IPv4 addresses + 28 domainsAlways available

Each group's IPs are fed into createVlessLink(), which constructs a fully-qualified vless:// URI. The builder applies group-specific transformations: random port selection from the allowed list, path obfuscation via the /random:N directive, SNI case randomization when randomizeSni: true, and TLS parameter injection when tls: true.

The output format follows the standard VLESS URI scheme:

text
vless://<uuid>@<ip>:<port>?path=<path>&encryption=none&type=ws&host=<host>&fp=<fp>&ed=<ed>&eh=<eh>&security=tls&sni=<sni>&alpn=<alpn>#<name>

4. Subscription Output ​

The final step encodes all VLESS URIs into a base64 subscription with custom HTTP headers that clients interpret as metadata:

HeaderValuePurpose
Content-Typetext/plain; charset=utf-8Standard text response
Profile-Update-Interval6Client auto-refreshes every 6 hours
Subscription-Userinfoupload=...; download=...; total=...; expire=...Fake usage stats for client UI display
Profile-Title"Harmony" (customizable via ?name= param)Subscription name shown in client

The fake subscription info (generateCakeSubscriptionInfo) simulates a 440 TB quota with dynamically varying usage based on the current hour of day, so the client's traffic counter always appears active and realistic.

Default Configuration Groups ​

Out of the box, Harmony ships with three groups that cover the most common deployment patterns. Each group independently fetches from its designated IP source and generates ipCount configurations.

GroupNameTLSPortsIP SourceSNI Randomization
1 β€” TLSHarmonyα΅€α΄ΈΛ’βœ…443, 8443, 2053, 2083, 2087, 2096dynamic1βœ…
2 β€” TCPHarmonyα΅€αΆœα΄ΎβŒ80, 8080, 8880, 2052, 2082, 2086, 2095dynamic2❌
3 β€” EmergencyHarmonyα΄±α΄ΉΛ’βœ…443, 2053staticβœ…

The Emergency group uses only static IPs β€” it's your fallback when external APIs are unreachable. You can add, remove, or reorder groups freely in the USER_SETTINGS.groups array.

Anti-Detection Features ​

Harmony bakes in several techniques that increase resilience against traffic analysis and censorship filtering:

  • SNI Case Randomization β€” Each request randomly uppercases ~50% of characters in the SNI hostname (e.g., iNdEx.HaRmOnIca01.wOrKeRs.DeV), which is valid per RFC 7617 but disrupts case-sensitive DPI signatures.
  • Path Obfuscation β€” The /random:18 directive generates a fresh 18-character random path on every config build, making each VLESS link unique even within a single subscription response.
  • Client Fingerprint β€” The fp=chrome parameter instructs Xray-core to mimic a Chrome browser's TLS ClientHello, blending the connection into normal HTTPS traffic.
  • Early Data β€” The ed=2560 parameter sends up to 2560 bytes of data in the first TLS flight, reducing round-trip latency for the initial WebSocket handshake.

Key Feature Summary ​

FeatureImplementationBenefit
Multi-source clean IPsdynamic1, dynamic2, static pipelineRedundancy against source outages
Per-request IP freshnessFull fetch on every client updateNo stale IPs; always current
3-second fetch timeoutfetchWithTimeout() with AbortControllerWorker never hangs on slow sources
Fisher-Yates shuffleshuffleArray()Even distribution of IPs across configs
Fake subscription headersgenerateCakeSubscriptionInfo()Client UI shows realistic traffic stats
Base64 subscription outputbtoa(configsList.join("\n"))Universal client compatibility
Custom subscription name?name= query parameter or #hashPersonalize subscription label in client

Next Steps ​

Now that you understand what Harmony does and how it's structured, follow this progression to get running:

  1. β€” Deploy Harmony to Cloudflare Workers in under 5 minutes.
  2. β€” Detailed deployment walkthrough with screenshots.
  3. β€” Deep dive into the request lifecycle and data flow.