Secure tunnels to localhost. A self-hosted ngrok alternative written in Crystal.
Sellia exposes your local development servers to the internet through secure tunnels. Run your own tunnel server or use the hosted service at sellia.me. Named after the Crystal Tunnel in Elden Ring.
Exposing local servers to the internet is essential for:
- Webhook development (Stripe, GitHub, etc.)
- Mobile app development against local APIs
- Sharing work-in-progress with clients
- Testing OAuth callbacks
Existing solutions like ngrok are excellent but can be expensive for individual developers. Sellia provides a fully open-source, self-hostable alternative with a familiar interface.
Features:
- Subdomain-based routing (
myapp.your-domain.com) - Real-time request inspector with web UI
- Automatic reconnection with exponential backoff
- Basic auth protection for tunnels
- Rate limiting and subdomain validation
- MessagePack-based binary protocol over WebSocket
Requires Crystal >= 1.10.0.
git clone https://github.com/watzon/sellia.git cd sellia shards build --releaseBinaries will be in ./bin/:
sellia- CLI clientsellia-server- Tunnel server
Coming soon.
1. Start the server (or use a hosted instance):
./bin/sellia-server --port 3000 --domain your-domain.com2. Create a tunnel to your local server:
./bin/sellia http 8080 --server http://localhost:30003. Access your local server at the provided URL (e.g., http://abc123.your-domain.com:3000).
sellia <command> [options] Commands: http <port> Create HTTP tunnel to local port start Start tunnels from config file auth Manage authentication version Show version help Show help HTTP Options: -s, --subdomain NAME Request specific subdomain -a, --auth USER:PASS Enable basic auth protection -H, --host HOST Local host (default: localhost) -k, --api-key KEY API key for authentication -i, --inspector-port Inspector UI port (default: 4040) -o, --open Open inspector in browser --no-inspector Disable the request inspector --server URL Tunnel server URL Examples:
# Basic tunnel sellia http 3000 # Custom subdomain sellia http 3000 --subdomain myapp # With basic auth sellia http 3000 --auth admin:secret # Using a specific server sellia http 3000 --server https://sellia.mesellia-server [options] Options: --host HOST Host to bind to (default: 0.0.0.0) --port PORT Port to listen on (default: 3000) --domain DOMAIN Base domain for subdomains --require-auth Require API key authentication --master-key KEY Master API key (enables auth) --https Generate HTTPS URLs for tunnels --no-rate-limit Disable rate limiting Environment Variables:
| Variable | Description |
|---|---|
SELLIA_HOST | Host to bind to |
SELLIA_PORT | Port to listen on |
SELLIA_DOMAIN | Base domain for subdomains |
SELLIA_REQUIRE_AUTH | Require authentication (true/false) |
SELLIA_MASTER_KEY | Master API key |
SELLIA_USE_HTTPS | Generate HTTPS URLs (true/false) |
SELLIA_RATE_LIMITING | Enable rate limiting (true/false) |
SELLIA_DEBUG | Enable debug logging (true/false) |
Sellia supports layered configuration. Files are loaded in order (later overrides earlier):
~/.config/sellia/sellia.yml~/.sellia.yml./sellia.yml- CLI flags
Example sellia.yml:
server: https://sellia.me api_key: your-api-key tunnels: web: port: 3000 subdomain: myapp api: port: 8080 subdomain: myapp-api auth: admin:secretStart all configured tunnels:
sellia startSellia includes a real-time request inspector accessible at http://localhost:4040 when a tunnel is running.
Features:
- Live request/response streaming
- Request details (headers, body, timing)
- Copy as cURL command
- Clear history
Disable with --no-inspector if not needed.
The easiest way to deploy Sellia is with Docker Compose:
# Clone and configure git clone https://github.com/watzon/sellia.git cd sellia # Create .env file cat > .env << EOF SELLIA_DOMAIN=yourdomain.com SELLIA_MASTER_KEY=$(openssl rand -hex 32) SELLIA_REQUIRE_AUTH=true SELLIA_USE_HTTPS=true EOF # Start the server docker compose -f docker-compose.prod.yml up -dSellia requires TLS certificates to serve HTTPS tunnels. You provide your own certificates - giving you flexibility to use Cloudflare Origin Certificates, Let's Encrypt, self-signed certs, or any other valid certificate.
Quick Setup with Cloudflare Origin Certificate (Recommended):
- Add your domain to Cloudflare (free tier works)
- Go to SSL/TLS → Origin Server → Create Certificate
- Select:
- Hostnames:
*.yourdomain.comandyourdomain.com - Validity: 15 years
- Key format: PEM (default)
- Hostnames:
- Click Create and download the certificate and key
- Place them in
./certs/directory:certs/ ├── cert.pem # Origin certificate └── key.pem # Private key - Update
.envwith your domain:SELLIA_DOMAIN=yourdomain.com
Alternative Certificate Sources:
- Let's Encrypt: Generate certificates yourself using certbot or another ACME client, then place
cert.pemandkey.pemin thecerts/directory - Self-signed: Generate your own certificates for local testing (note: browsers will show warnings)
Example .env file:
SELLIA_DOMAIN=yourdomain.com SELLIA_MASTER_KEY=$(openssl rand -hex 32) SELLIA_REQUIRE_AUTH=true SELLIA_USE_HTTPS=trueStart the server:
docker compose -f docker-compose.prod.yml up -d# Install dependencies shards install # Build debug binaries shards build # Build release binaries shards build --release # Run tests crystal speccd web npm install npm run devThe CLI will proxy to Vite's dev server at localhost:5173 when not built with embedded assets.
src/ ├── core/ # Shared protocol and types │ └── protocol/ # MessagePack message definitions ├── server/ # Tunnel server components │ ├── tunnel_registry.cr │ ├── ws_gateway.cr │ ├── http_ingress.cr │ └── ... └── cli/ # CLI client components ├── tunnel_client.cr ├── inspector.cr └── ... web/ # React inspector UI spec/ # Tests Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please use conventional commits for commit messages.
MIT © Chris Watson