Skip to content

Feature: Self-hosted tunnel service for zero-config public relay access #25

Description

@melvincarvalho

Vision

Enable users to run personal Nostr relays on their phones with instant public access via a fonstr-hosted tunnel service.

Example:

npx fonstr --tunnel

# Instantly outputs:
✅ Your relay: wss://npub1abc...xyz.fonstr.com/relay
✅ Your profile: https://npub1abc...xyz.fonstr.com/

Why This is Important

  • Zero friction - Anyone can run a personal relay without port forwarding, static IPs, or DNS setup
  • Identity = Relay - Your npub IS your relay address (beautiful!)
  • Mobile-first - Phone becomes your personal data server
  • Truly decentralized - Everyone runs their own relay, fonstr just provides the tunnel

Architecture Options

Option 1: SSH-based (like Serveo)

  • Users: ssh -R 0:localhost:4444 tunnel.fonstr.com
  • Server maps to subdomain based on npub
  • Pros: Secure, works everywhere
  • Cons: Need custom SSH server

Option 2: WebSocket tunnel

  • Lightweight websocket client in fonstr
  • Connects to fonstr.com tunnel server
  • Pros: Built into fonstr, seamless
  • Cons: Need to write client/server

Option 3: Use frp (Fast Reverse Proxy) ⭐ Recommended

  • Package frp client with fonstr
  • Run frps server at tunnel.fonstr.com
  • Pros: Mature, battle-tested, Apache 2.0 licensed
  • Cons: Extra dependency (~10MB binary)

Implementation Plan

Phase 1: Infrastructure

  1. Set up VPS for tunnel.fonstr.com ($5-10/mo)
  2. Install frps (frp server)
  3. Configure wildcard DNS: *.fonstr.com → VPS
  4. Set up wildcard SSL with LetsEncrypt
  5. Configure reverse proxy (nginx/caddy)

Phase 2: Client Integration

  1. Bundle frpc (frp client) with fonstr
  2. Add --tunnel flag to fonstr CLI
  3. Auto-generate frpc config based on npub
  4. Auto-connect on startup
  5. Display public URL in console

Phase 3: Features

  • Dashboard at fonstr.com showing active relays
  • Stats (uptime, storage, events)
  • Optional custom subdomains (premium?)
  • Public relay discovery at fonstr.com/explore

Technical Details

frp Server Config (tunnel.fonstr.com)

[common]
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
subdomain_host = fonstr.com

Auto-generated Client Config (in fonstr)

[common]
server_addr = tunnel.fonstr.com
server_port = 7000

[npub1abc...xyz]
type = http
local_port = 4444
subdomain = npub1abc...xyz

URL Mapping

  • https://npub1abc...xyz.fonstr.com/ → index.html
  • wss://npub1abc...xyz.fonstr.com/relay → Nostr relay WebSocket
  • https://npub1abc...xyz.fonstr.com/me/ → Solid pod

Benefits

For Users:

  • One command to go from local to public
  • No technical knowledge needed
  • Works on mobile, desktop, servers
  • Permanent subdomain tied to identity

For Nostr Ecosystem:

  • Lowers barrier to running personal relays
  • Truly decentralized (everyone runs their own)
  • Identity-first architecture
  • Encourages data sovereignty

For fonstr Project:

  • Killer feature that differentiates from other relays
  • Natural monetization path (premium features)
  • Community building (relay directory)
  • Aligns with "Just works" philosophy

Cost Estimate

  • VPS: $5-10/mo (Hetzner/DigitalOcean)
  • Domain: Already owned (fonstr.com)
  • SSL: Free (Let's Encrypt)
  • Software: Free (frp is Apache 2.0)
  • Bandwidth: Depends on usage

Open Questions

  1. Should we use full npub or shortened version for subdomain?
  2. Rate limiting per tunnel?
  3. Storage limits per relay?
  4. Premium tier for custom domains?
  5. Should tunnel be opt-in or default?

References

Tagline

"Your phone. Your relay. Your identity."


cc @melvincarvalho - This came from brainstorming how to make fonstr even easier to use on mobile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions