Nostr relay + web server - Just works on phones, servers, everywhere
npm install fonstr



---
``bash`
npx fonstr
That'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:
`bash`
npx fonstr
Under 90 seconds from zero to running relay. On a phone. In your pocket.
---
Type one command. Get all of this:
---
`bash`
npx fonstr
Done. Your relay is live at:
- Nostr relay: ws://localhost:4444/relayhttp://localhost:4444
- Web interface:
`bash`
npx fonstr 8080
Relay now at ws://localhost:8080/relay
` Connect with any Nostr client:bash
mkdir fonstr-data
cat > fonstr-data/index.html << 'EOF'
โก Welcome to My Relay
ws://localhost:4444/relay
EOF
npx fonstr
`
Visit http://localhost:4444 โ See your beautiful landing pagews://localhost:4444/relay
Connect to โ Use your relay
`bashPut your SSL certs in current directory:
- fullchain.pem
- privkey.pem
npx fonstr --https
`
Now 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:
`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)
}
`
---
`bash`
PORT=8080 npx fonstr # Custom port
DATA_ROOT=/var/fonstr npx fonstr # Custom data directory
`bash`
npx 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 authentication
---
Powered by JavaScriptSolidServer, fonstr can do more when you need it:
Enable via command-line flags when needed. Default is simple relay mode.
---
`bash`
npx fonstr
`bash`
npx fonstr 4444Develop your app
Stop relay (Ctrl+C)
`bash`
mkdir my-relay-site
cd my-relay-siteAdd index.html, logo.png, etc.
DATA_ROOT=. npx fonstr
`bash`On Android with Termux
pkg install nodejs-lts
npx fonstr
`bash`
npx fonstr --https --port 443
---
Prefer Docker? We got you:
`bash`
docker run -d -p 4444:4444 ghcr.io/nostrapps/fonstr:latest
Or build locally:
`bash`
git clone https://github.com/nostrapps/fonstr.git
cd fonstr
docker build -t fonstr .
docker run -d -p 4444:4444 fonstr
---
Once 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:
`bash1. Install Termux from F-Droid
2. Open Termux, run:
pkg update && pkg install nodejs-lts
npx fonstr
No other relay can do this.
---
๐ ๏ธ Advanced Configuration
$3
`bash
Store events to disk (optional)
npx fonstr --solid-storage
`$3
`bash
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 443
`Now accessible at
wss://yourdomain.com/relay$3
`nginx
/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";
}
}
`---
๐ Learn More
$3
- Nostr Protocol - Core protocol
- NIPs - Protocol specs
- Awesome Nostr - Ecosystem$3
- Blog Post - Run relay on phone
- JavaScriptSolidServer - Underlying engine
- Issues - Report bugs, request features---
โ FAQ
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 5555Q: 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.
---
๐ค 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.
---
๐ License
MIT License - Use freely, commercially or personally.
See LICENSE for details.
---
๐ Built With
- JavaScriptSolidServer - Full-featured Solid + Nostr server
- nostr-tools - Nostr protocol utilities
- Fastify - Fast web framework
---
โก Start Your Relay Now
`bash
npx fonstr
``
One command. One relay. Zero hassle.
โญ Star this repo if fonstr helped you!
---
fonstr - The easiest way to run a Nostr relay. Period.