Shogun Relay is a production-ready connection hub that unifies GunDB and IPFS into a single solution.
- GunDB Relay — WebSocket relay with SQLite/RADISK persistence and WebRTC support
- IPFS Integration — Upload, pin, manage, and preview IPFS content via REST API
- Torrent Manager — Download, seed, and stream torrents; built-in search (Internet Archive)
- Admin Dashboards — Real-time monitoring, visual graph explorer, file manager, and config editor
- x402 Subscriptions — Paid storage subscriptions via USDC (EIP-3009)
- L2 Bridge — Trustless ETH bridge between L1 and GunDB L2
- Network Federation — Relay discovery, storage proofs, and reputation system
- On-Chain Registry — Staking and slashing on Base blockchain
- Anna's Archive — Automated mirroring and indexing of scientific/cultural content
git clone <repository-url>
cd shogun-relay
./docker-start.sh
curl http://localhost:8765/healthcd shogun-relay/relay
npm install
npm run devAdmin dashboards: http://localhost:8765/
Create a .env file with essential variables:
| Variable | Description | Default |
|---|---|---|
ADMIN_PASSWORD |
Admin token for all routes | (required) |
IPFS_API_URL |
IPFS API endpoint | http://127.0.0.1:5001 |
RELAY_PORT |
HTTP port | 8765 |
STORAGE_TYPE |
sqlite or radisk |
sqlite |
See Environment Variables for complete reference.
| Path | Description |
|---|---|
/admin |
Main control panel |
/stats |
Live metrics & charts |
/torrents |
Torrent manager & search |
/services-dashboard |
Service health overview |
/config |
Runtime configuration editor |
/pin-manager |
IPFS pin manager |
/upload |
IPFS uploads |
/drive |
Admin file browser |
/visualGraph |
GunDB explorer |
/graphExplorer |
Advanced graph navigator |
/registry-dashboard |
On-chain registry |
/endpoints |
API documentation |
The relay includes a built-in SSH tunnel to srv.us for public access without configuring router ports.
- The tunnel service starts automatically with
docker-compose. - To find your public URL, check the tunnel logs:
docker-compose logs -f tunnel # Look for lines like: # https://<random-id>.srv.us
- The URL remains stable as long as the
tunnel_datavolume is preserved.
| Document | Description |
|---|---|
| API Reference | Complete REST API documentation |
| Environment Variables | All configuration options |
| Node Operator Guide | Run your own relay |
| L2 Bridge | ETH bridge between L1 and L2 |
| x402 Payments | Subscription payment system |
| Storage Deals | Per-file contracts & erasure coding |
| Network Federation | Relay discovery & reputation |
| Relay Keys | Keypair configuration |
| Roadmap | Evolution path |
| Endpoint | Description |
|---|---|
GET /gun |
WebSocket for Gun clients |
GET /health |
Health check |
GET /api/v1/system/stats |
System statistics |
| Endpoint | Description |
|---|---|
POST /api/v1/ipfs/upload |
Upload single file |
POST /api/v1/ipfs/upload-directory |
Upload multiple files as directory (maintains structure) |
GET /api/v1/ipfs/cat/:cid |
Stream content |
POST /api/v1/ipfs/pin/add |
Pin content |
GET /api/v1/ipfs/pin/ls |
List pins |
| Endpoint | Description |
|---|---|
GET /api/v1/torrent/status |
List active torrents |
POST /api/v1/torrent/add |
Add magnet/torrent |
POST /api/v1/torrent/control |
Pause/Resume/Remove |
GET /api/v1/torrent/search/internet-archive |
Search Internet Archive |
GET /api/v1/torrent/search |
Unified search |
| Endpoint | Description |
|---|---|
GET /api/v1/user-uploads/system-hashes-map |
Get complete file metadata map |
POST /api/v1/user-uploads/save-system-hash |
Save file metadata (admin) |
DELETE /api/v1/user-uploads/remove-system-hash/:cid |
Remove file metadata |
| Endpoint | Description |
|---|---|
POST /api/v1/bridge/deposit |
Record L1 deposit |
POST /api/v1/bridge/withdraw |
Request withdrawal |
GET /api/v1/bridge/balance/:user |
Get L2 balance |
Full API documentation at /endpoints or see API Reference.
shogun-relay/
├── relay/
│ ├── src/
│ │ ├── index.ts # Express + Gun bootstrap
│ │ ├── routes/ # REST endpoints
│ │ └── public/ # Admin frontends
├── docs/ # Documentation
└── docker/ # Docker utilities
| Issue | Solution |
|---|---|
| Gun clients fail to connect | wscat -c ws://localhost:8765/gun |
| IPFS API unauthorized | Check IPFS_API_TOKEN |
| Admin UI "token required" | Enter token at /admin first |
- Fork the repository
- Create a feature branch
- Add tests when relevant
- Submit a pull request
MIT License © Shogun contributors. See LICENSE.