When to Use
Limited Uptime
When peers have sporadic connectivity
Reliable Fallback
Need guaranteed availability for critical data
Temporary Coordination
Bootstrap new networks or coordinate during low peer counts
What It Does
The fallback server is just another peer in the network. It:- Stays online 24/7 to ensure data availability
- Participates in P2P sync like any other node
- Stores the graph state for retrieval when offline peers reconnect
- Does NOT introduce centralization (peers can sync directly with each other)
The fallback server does not control the network or act as a central authority. It simply improves availability for applications where uptime is critical.
Deploy to Heroku (One Click)
The easiest way to run a fallback server:- Runs on Heroku’s free/hobby tier
- Automatically connects to Nostr relays
- Persists graph state to disk (Heroku ephemeral filesystem)
- Provides a simple health check endpoint
Manual Installation
Prerequisites
- Node.js 16+
- NPM or Yarn
Setup
Environment Variables
Start the Server
Verify
Client Configuration
Clients automatically discover and connect to the fallback server via Nostr relays:As long as the fallback server uses the same
dbName and connects to the same Nostr relays, clients will discover and sync with it automatically.Architecture
Use Cases
1. Low Concurrent Users
Problem: If only 1-2 users are typically online, they may not overlap and miss each other’s updates. Solution: Fallback server is always online to relay updates.2. Mobile Clients
Problem: Mobile browsers often close tabs aggressively, breaking P2P connections. Solution: Fallback server maintains state continuity.3. Development and Testing
Problem: During development, reloading the page frequently disrupts P2P connections. Solution: Fallback server provides stable peer for testing.Scaling Considerations
Single Server Limitations
Single Server Limitations
One fallback server can handle:
- 100-500 concurrent connections (depends on server specs)
- Moderate data throughput (MessagePack + compression helps)
- Disk space for graph persistence
- Multiple fallback servers in different regions
- Load balancing via multiple Nostr relays
High Availability
High Availability
Deploy multiple fallback servers:Clients discover both servers and sync with whichever is reachable.
Data Persistence
Data Persistence
By default, GenosDB server uses OPFS/IndexedDB (browser-based). For Node.js:
- Stores graph in file system (
./data/my-app-db.bin) - Automatic persistence on updates
- Consider backing up this file periodically
Monitoring
Add simple logging to track server health:Security
Alternative: Client-Side “Always-On” Peer
Instead of a dedicated server, you can designate a long-running client (e.g., desktop app) as a pseudo-fallback:Related Pages
GenosRTC Architecture
P2P networking overview
Nostr Signaling
Run your own relay