A high-performance, zero-configuration gateway for Swarm that routes domains based on DNSLink records.
Swarm Router allows you to point any domain to Swarm content without configuring the server. It uses a "Pull" model where the configuration lives in the DNS records of the domains themselves, rather than a central configuration file.
- Caddy (with caddy-dnslink): The entry point. It intercepts requests, looks up the
_dnslinkTXT record for the hostname, and rewrites the request to the corresponding Swarm hash. - Gatekeeper: A security sidecar that validates domains before Caddy issues TLS certificates. It ensures that only domains with valid DNSLink records are allowed to consume resources.
- Varnish: A high-performance HTTP accelerator that caches Swarm content to reduce load on the Bee node and improve response times.
- Bee: The Swarm node that retrieves content from the decentralized network.
- Zero-Configuration: Add a new domain just by creating DNS records. No server restarts or API calls required.
- On-Demand TLS: Automatically provisions and renews HTTPS certificates for any valid domain that points to the router.
- DNSLink Support: Fully compatible with the DNSLink standard.
- Smart Caching: Varnish caching tuned for immutable Swarm content.
- DDoS Protection: Gatekeeper prevents TLS abuse by verifying domain ownership via DNS before issuance.
To point a domain to your Swarm Router:
-
CNAME Record: Point your domain to the router's hostname (or A record to its IP).
example.com. IN CNAME router.your-domain.com. -
TXT Record: Create a
_dnslinkTXT record containing the Swarm reference._dnslink.example.com. IN TXT "dnslink=/swarm/<hash>"
The router will automatically detect these records, provision an SSL certificate, resolve the hash, and serve the content.
This project is optimized for deployment on the Akash Network.
- Use the provided
deploy.yaml. - Adjust the resource profiles if necessary.
- Deploy using the Akash Console or CLI.
You can run the stack locally or on a VPS using Docker Compose:
docker compose up -dswarm-router-caddy: Custom Caddy build including the caddy-dnslink module.swarm-router-gatekeeper: Go service that acts as anaskendpoint for Caddy's On-Demand TLS.swarm-router-varnish: Varnish Cache configured for Swarm.ethersphere/bee: Official Swarm node.
MIT