npx fonstrThat's it. You now have a Nostr relay running at ws://localhost:4444/relay
No config files. No dependencies. No Docker. No setup. It just works.
Run a Nostr relay on your Android phone with Termux:
npx fonstrUnder 90 seconds from zero to running relay. On a phone. In your pocket.
Type one command. Get all of this:
- β NIP-01 compliant (EVENT, REQ, CLOSE, EOSE)
- β NIP-11 relay information endpoint
- β NIP-98 HTTP authentication with Nostr keys
- β Event filtering, subscriptions, real-time updates
- β Rate limiting & memory protection
- β WebSocket (ws://) and secure WebSocket (wss://)
- β Serve your relay's landing page
- β Static file hosting (HTML, CSS, JS, images)
- β REST APIs
- β HTTPS support
- β CORS enabled
- β Android/Termux (install in under 90 seconds!)
- β Windows (no build tools needed!)
- β macOS, Linux, Raspberry Pi
- β Pure JavaScript (no compilation, no native modules)
- β Node.js 18+ only requirement
npx fonstrDone. Your relay is live at:
- Nostr relay:
ws://localhost:4444/relay - Web interface:
http://localhost:4444
npx fonstr 8080Relay now at ws://localhost:8080/relay
mkdir fonstr-data
cat > fonstr-data/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>My Nostr Relay</title>
<style>
body {
font-family: system-ui;
max-width: 600px;
margin: 100px auto;
text-align: center;
}
code {
background: #f4f4f4;
padding: 20px;
display: block;
margin: 20px 0;
border-radius: 8px;
}
</style>
</head>
<body>
<h1>β‘ Welcome to My Relay</h1>
<p>Connect with any Nostr client:</p>
<code>ws://localhost:4444/relay</code>
</body>
</html>
EOF
npx fonstrVisit http://localhost:4444 β See your beautiful landing page
Connect to ws://localhost:4444/relay β Use your relay
# Put your SSL certs in current directory:
# - fullchain.pem
# - privkey.pem
npx fonstr --httpsNow you have wss:// (secure WebSocket) for production use.
| Other Relays | fonstr |
|---|---|
| Install dependencies | β
Zero install (npx) |
| Configure settings | β Zero config (sensible defaults) |
| Setup database | β Zero setup (works out of box) |
| Compile native code | β Pure JavaScript (no compilation) |
| Read documentation | β One command to start |
| 5-30 minutes | β 10 seconds |
Don't let "easy" fool you. fonstr is fast:
- β‘ Startup: ~3 seconds
- β‘ Response time: Sub-millisecond
- β‘ Throughput: 1,500+ requests/second
- β‘ Install (Android): Under 90 seconds from scratch
- β‘ Memory: ~80MB (efficient)
Connect from any Nostr client, or test with JavaScript:
// Connect to your relay
const relay = new WebSocket('ws://localhost:4444/relay')
relay.onopen = () => {
// Subscribe to notes
relay.send(JSON.stringify([
'REQ',
'my-sub',
{ kinds: [1], limit: 10 }
]))
}
relay.onmessage = (msg) => {
const [type, ...data] = JSON.parse(msg.data)
console.log('Received:', type, data)
}PORT=8080 npx fonstr # Custom port
DATA_ROOT=/var/fonstr npx fonstr # Custom data directorynpx fonstr --help # Show all options
npx fonstr --port 8080 # Custom port
npx fonstr --root ./data # Custom data directory
npx fonstr --https # Enable HTTPS/WSS
npx fonstr --multiuser # Multi-user mode
npx fonstr --no-auth # Disable authenticationPowered by JavaScriptSolidServer, fonstr can do more when you need it:
- π WebAuthn/Passkeys: Passwordless authentication
- π Solid Protocol: Decentralized personal data pods
- π ActivityPub: Federate with Mastodon/Pleroma
- π OIDC Provider: OpenID Connect identity server
- π₯ Multi-user: Host relays for multiple users
Enable via command-line flags when needed. Default is simple relay mode.
Run your own relay. Keep your notes. Own your data.
npx fonstrTest your Nostr app against a local relay.
npx fonstr 4444
# Develop your app
# Stop relay (Ctrl+C)Run a relay for your community with a custom landing page.
mkdir my-relay-site
cd my-relay-site
# Add index.html, logo.png, etc.
DATA_ROOT=. npx fonstrRun a relay on your Android phone. Take it anywhere.
# On Android with Termux
pkg install nodejs-lts
npx fonstrScale to thousands of users with HTTPS/WSS.
npx fonstr --https --port 443Prefer Docker? We got you:
docker run -d -p 4444:4444 ghcr.io/nostrapps/fonstr:latestOr build locally:
git clone https://github.com/nostrapps/fonstr.git
cd fonstr
docker build -t fonstr .
docker run -d -p 4444:4444 fonstrOnce running, your relay exposes:
| Endpoint | Purpose | Example |
|---|---|---|
ws://localhost:4444/relay |
Nostr relay WebSocket | Connect with any client |
http://localhost:4444/relay/info |
NIP-11 relay info (JSON) | Relay metadata |
http://localhost:4444/ |
Web server root | Serve your landing page |
Proof: Install fonstr on a fresh Android phone with Termux:
# 1. Install Termux from F-Droid
# 2. Open Termux, run:
pkg update && pkg install nodejs-lts
npx fonstr
# Done. Under 90 seconds total.No other relay can do this.
# Store events to disk (optional)
npx fonstr --solid-storage# 1. Get SSL cert (Let's Encrypt)
# 2. Put fullchain.pem and privkey.pem in current directory
# 3. Run with HTTPS
npx fonstr --https --port 443Now accessible at wss://yourdomain.com/relay
# /etc/nginx/sites-available/relay
upstream fonstr {
server 127.0.0.1:4444;
}
server {
listen 80;
server_name relay.yourdomain.com;
location / {
proxy_pass http://fonstr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}- Nostr Protocol - Core protocol
- NIPs - Protocol specs
- Awesome Nostr - Ecosystem
- Blog Post - Run relay on phone
- JavaScriptSolidServer - Underlying engine
- Issues - Report bugs, request features
Q: Do I need to install anything?
A: No. npx downloads and runs fonstr temporarily. Node.js 18+ is the only requirement.
Q: Where are events stored?
A: In memory by default. Use --solid-storage to persist to disk.
Q: Can I use this in production?
A: Yes! Use --https for WSS support. fonstr handles 1,500+ req/sec.
Q: What's the difference from other relays? A: fonstr is the easiest to install and run. Zero config, zero setup, works everywhere.
Q: Can I run multiple relays?
A: Yes. Use different ports: npx fonstr 4444 and npx fonstr 5555
Q: Does it support NIP-XX? A: Supports NIP-01 (core), NIP-11 (info), NIP-98 (auth). More NIPs coming soon.
Q: Can I contribute? A: Yes! PRs welcome. See Contributing.
We welcome contributions!
- π Bug reports: Open an issue
- π‘ Feature requests: Start a discussion
- π§ Pull requests: Fork, change, PR
- π Documentation: Help improve docs
For relay engine bugs, report to JavaScriptSolidServer.
MIT License - Use freely, commercially or personally.
See LICENSE for details.
- JavaScriptSolidServer - Full-featured Solid + Nostr server
- nostr-tools - Nostr protocol utilities
- Fastify - Fast web framework
npx fonstrOne command. One relay. Zero hassle.
β Star this repo if fonstr helped you!
fonstr - The easiest way to run a Nostr relay. Period.