Skip to content

nellimonix/warp-config-generator-vercel

Repository files navigation

WARP Configuration Generator

Русский | English

WARP Generator screenshot

Open-source generator for Cloudflare WARP configs (WireGuard / AmneziaWG / Clash / Throne / Nekoray / Husi / Karing / WireSock). This is the public branch β€” no captcha, no analytics, no promo blocks. Deploy your own.

πŸš€ Quick Deployment

Docker (recommended)

Pre-built image is published to GHCR on every push to master:

docker run -d --name warp-generator \
  -p 3000:3000 \
  --restart unless-stopped \
  ghcr.io/nellimonix/warp-config-generator-vercel-public:latest

Open http://localhost:3000.

Docker β€” build locally

docker build -t warp-generator-public .
docker run -d -p 3000:3000 --name warp-generator warp-generator-public

docker-compose

services:
  warp-generator:
    image: ghcr.io/nellimonix/warp-config-generator-vercel-public:latest
    container_name: warp-generator
    ports:
      - "3000:3000"
    restart: unless-stopped

Vercel

Deploy with Vercel

  • Or via CLI: vercel deploy
  • Local dev: vercel dev

Netlify

Deploy to Netlify

  • Or via CLI: netlify deploy
  • Local dev: netlify dev

Cloudflare Workers

Deploy to Cloudflare Workers

  • Or via Wrangler: wrangler deploy
  • Local dev: wrangler dev

Cloudflare Pages

The same wrangler.jsonc deploys to Pages with the static export.

CLOUDFLARE_WORKERS=1 npm run build
npx wrangler pages deploy out --project-name=warp-generator

Or connect the repo in the Cloudflare dashboard:

  • Build command: CLOUDFLARE_WORKERS=1 npm run build
  • Output directory: out

πŸ› οΈ Local Development

npm install
npm run dev          # dev server on :3000
npm run build        # production build
npm run start        # serve production build
npm run lint

βš™οΈ Generator Options and API

The generator exposes the same options in the UI and in POST /api/generate:

Option Behavior and constraints
DNS Providers come from config/dns.ts. Community providers are marked with β€’; selecting one forces All sites and clears selected services because they do not support split tunneling. An unknown provider ID falls back to Cloudflare DNS.
IPv6 Enabled by default. Disabling it removes IPv6 from the interface address, DNS list, and the default all-sites AllowedIPs.
Exclude LAN Available only in All sites mode. It replaces the default routes with public address ranges so private/reserved LAN ranges stay outside the tunnel.
PersistentKeepalive Disabled by default. Enabling it with an empty UI field uses 25; the API accepts integers from 1 through 65535 and omits invalid values. It is emitted by WireGuard and WireSock configs.
Custom I1 A non-empty value is trimmed and must be at most 253 characters with no whitespace. AmneziaWG WireGuard uses it to generate a QUIC I1 mask; WireSock uses it as Id. Empty or invalid input silently falls back to a bundled random mask/domain.

Example request against a local deployment:

curl -X POST http://localhost:3000/api/generate \
  -H 'Content-Type: application/json' \
  -d '{
    "selectedServices": [],
    "siteMode": "all",
    "deviceType": "awg15",
    "endpoint": "engage.cloudflareclient.com:4500",
    "configFormat": "wireguard",
    "dnsId": "cf",
    "ipv6": false,
    "excludeLan": true,
    "persistentKeepalive": 25,
    "customI1Domain": "google.com"
  }'

A successful response has success: true and a content object containing configBase64, qrCodeBase64, configFormat, and fileName. configBase64 contains the Base64-encoded configuration; qrCodeBase64 is an image data URL.

βž• Adding a new service (PR welcome)

The "specific sites" mode lets users select services to route through WARP. To add one:

  1. Fork the repo and create a branch (e.g. feat/service-newsite).
  2. Create config/services/<your-service-key>.json:
    {
      "name": "Display Name",
      "icon": "FaIconName",
      "iconLibrary": "fa",
      "type": "new",
      "ips": "1.2.3.0/24, 5.6.7.0/24, ..."
    }
    • name β€” user-visible service name.
    • icon β€” icon name from react-icons. Verify the name exists in the chosen library.
    • iconLibrary β€” one of: fa, fa6, si, bi, md, ri, etc. (matches react-icons sub-package).
    • type β€” optional. Set "new" to show a "NEW" badge.
    • ips β€” comma-separated CIDR ranges. Use a real ASN/IP lookup tool β€” Cloudflare's whois, BGP.tools, or whois -h whois.cymru.com " -v <ip>".
  3. Do NOT edit worker/api-handler.js or functions/api/generate.js. A GitHub Action (build-ip-ranges) rebuilds the IP_RANGES blocks in both files automatically on merge to master, and syncs the new service into the production branch.
  4. Open a PR to master.

Local preview of the rebuild

node scripts/build-ip-ranges.mjs

Runs against config/services/*.json and rewrites the // IP_RANGES:BEGIN ... // IP_RANGES:END block in both worker/functions files. Safe to run repeatedly β€” idempotent.

Adding a DNS provider

  1. Add the provider to DNS_PROVIDERS in config/dns.ts with a unique id, display label, IPv4/IPv6 arrays, and isCommunity.
  2. Set isCommunity: true if the provider cannot be used with specific-site routing. Both the UI and API enforce the all-sites restriction.
  3. Mirror the entry in the embedded DNS_PROVIDERS arrays in worker/api-handler.js and functions/api/generate.js. Unlike IP ranges and I1 masks, DNS providers do not currently have an automatic sync script.
  4. Run npm run build before opening the PR.

Docker and Vercel use config/dns.ts directly, while Cloudflare Workers and Netlify execute the embedded handlers. Keeping all three provider lists in sync prevents a provider shown by the static UI from falling back to Cloudflare DNS at generation time.

Maintaining default I1 masks

lib/builders/shared.ts is the source of truth for masks used when no custom I1 domain is supplied:

  1. Edit only the I1_MASKS array between the // I1_MASKS:BEGIN and // I1_MASKS:END markers.
  2. Run node scripts/build-i1-masks.mjs.
  3. Commit the generated changes to worker/api-handler.js and functions/api/generate.js with the source change.

The script validates the markers and mask format, updates both embedded handlers, and is idempotent. The build-i1-masks workflow also runs when its source, script, or workflow changes on master and rebuilds the production handlers. Do not hand-edit generated I1 blocks.

πŸ“ Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ layout.tsx                 Root layout (Geist font, meta)
β”‚   β”œβ”€β”€ page.tsx                   Server component β€” loads services
β”‚   β”œβ”€β”€ not-found.tsx              404 page
β”‚   └── api/generate/route.ts      POST endpoint (config generation)
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ home-client.tsx            Client shell (tabs, state)
β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”œβ”€β”€ topbar.tsx             Logo + tab navigation
β”‚   β”‚   β”œβ”€β”€ sidebar.tsx            GitHub link + server list (sticky)
β”‚   β”‚   └── footer.tsx
β”‚   β”œβ”€β”€ generator/
β”‚   β”‚   β”œβ”€β”€ config-selectors.tsx   Custom dropdowns (format, device, etc.)
β”‚   β”‚   β”œβ”€β”€ advanced-settings.tsx  IPv6, keepalive, and custom I1 controls
β”‚   β”‚   β”œβ”€β”€ service-picker.tsx     Service selection grid
β”‚   β”‚   β”œβ”€β”€ result-panel.tsx       Download / copy / QR result block
β”‚   β”‚   β”œβ”€β”€ formats-tab.tsx        Supported formats list
β”‚   β”‚   └── about-tab.tsx          About + compatible clients
β”‚   └── icons/                     Icon resolver + flag icons
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ services/                  JSON files β€” one per service (IP ranges)
β”‚   β”œβ”€β”€ services-loader.ts         Auto-loads all JSONs at startup
β”‚   β”œβ”€β”€ dns.ts                     DNS providers and split-tunnel constraints
β”‚   β”œβ”€β”€ endpoints.ts               Cloudflare WARP endpoints
β”‚   └── formats.ts                 Config format definitions
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ builders/                  One file per config format
β”‚   β”‚   β”œβ”€β”€ wireguard.ts
β”‚   β”‚   β”œβ”€β”€ throne.ts
β”‚   β”‚   β”œβ”€β”€ clash.ts
β”‚   β”‚   β”œβ”€β”€ nekoray.ts
β”‚   β”‚   β”œβ”€β”€ husi.ts
β”‚   β”‚   β”œβ”€β”€ karing.ts
β”‚   β”‚   β”œβ”€β”€ wiresock.ts
β”‚   β”‚   β”œβ”€β”€ shared.ts              Device profiles and default I1 masks
β”‚   β”‚   └── index.ts               Dispatcher β€” buildConfig(format, params)
β”‚   β”œβ”€β”€ warp-service.ts            Orchestrator (keys β†’ CF β†’ build β†’ QR)
β”‚   β”œβ”€β”€ quic.ts                    Custom QUIC I1 mask generation
β”‚   β”œβ”€β”€ cloudflare-client.ts       Cloudflare WARP API registration
β”‚   β”œβ”€β”€ crypto.ts                  Key generation (tweetnacl)
β”‚   β”œβ”€β”€ qr-generator.ts            QR via external API + SVG fallback
β”‚   └── ip-ranges.ts               Re-exports from services-loader
β”‚
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ use-generator.ts           Client-side generation logic
β”‚   └── use-mobile.ts              Responsive breakpoint hook
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ build-ip-ranges.mjs        Regenerates IP_RANGES in worker + functions
β”‚   └── build-i1-masks.mjs         Regenerates I1_MASKS in worker + functions
β”‚
β”œβ”€β”€ worker/                        Cloudflare Workers runtime
β”œβ”€β”€ functions/                     Netlify Functions runtime
β”œβ”€β”€ types/                         TypeScript type definitions
β”œβ”€β”€ styles/globals.css             Design tokens + dark theme
β”œβ”€β”€ .github/workflows/             CI: Docker, IP_RANGES, I1_MASKS rebuilds
β”œβ”€β”€ Dockerfile                     Standalone production build (public)
β”œβ”€β”€ next.config.mjs
└── package.json

πŸ”§ Configuration

No environment variables required for the public build. The generator runs anonymously against the public Cloudflare WARP registration API.

Build modes

next.config.mjs switches output based on environment:

Env var Output Used by
DOCKER_BUILD=1 standalone Docker / Dokploy
CLOUDFLARE_WORKERS / CF_PAGES export CF Workers / CF Pages
none default Vercel / Netlify

🌐 Supported Platforms

Platform Support Notes
Docker (self-host) βœ… Full standalone Next.js server
Vercel βœ… Full default runtime
Netlify βœ… Full Edge functions
Cloudflare Workers βœ… Full static export + worker
Cloudflare Pages βœ… Full static export

πŸ“„ License

MIT License β€” see LICENCE

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Open a Pull Request

πŸ”— Mirrors / Alternative Links

About

WARP configuration generator with support for various deployment platforms (Vercel, Netlify, Cloudflare)

Resources

License

Stars

963 stars

Watchers

10 watching

Forks

Packages

 
 
 

Contributors