Skip to content

scobru/shogun-relay

Repository files navigation

Shogun Relay

CI npm License TypeScript Tests Ask DeepWiki


Shogun Relay is a production-ready connection hub that unifies GunDB and IPFS into a single solution.

Features

  • GunDB Relay — WebSocket relay with SQLite/RADISK persistence and WebRTC support
  • IPFS Integration — Upload, pin, manage, and preview IPFS content via REST API
  • Admin Dashboard — Modern React-based UI for monitoring and management
  • Network Federation — Relay discovery, storage proofs, and reputation system

Quick Start

Docker

git clone <repository-url>
cd shogun-relay
./docker-start.sh

curl http://localhost:8765/health

CapRover Deployment

When deploying via CapRover, you must configure the Container HTTP Port in the app settings to correctly route NGINX traffic.

  1. Go to your CapRover Dashboard -> Apps -> shogun-relay -> HTTP Settings.
  2. Set Container HTTP Port to 8765.
  3. Click Save & Update.

(Failure to do this will result in 502 Bad Gateway or 504 Gateway Timeout errors).

Manual

cd shogun-relay/relay
npm install
npm run start:dev

Admin dashboards: http://localhost:8765/


Configuration

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
/dashboard New React Dashboard (Recommended)
/admin Legacy entry (redirects)
/endpoints API reference explorer

Development

| API Reference | Complete REST API documentation | | Environment Variables | All configuration options | | Node Operator Guide | Run your own relay | | Network Federation | Relay discovery & reputation | | Relay Keys | Keypair configuration |


API Overview

Core Endpoints

Endpoint Description
GET /gun WebSocket for Gun clients
GET /health Health check
GET /api/v1/system/stats System statistics

IPFS

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

User Uploads & Metadata

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

Full API documentation at /endpoints or see API Reference.


Project Structure

shogun-relay/
├── relay/
│   ├── src/
│   │   ├── index.ts       # Express + Gun bootstrap
│   │   ├── routes/        # REST endpoints
│   │   └── public/        # Admin frontends
├── docs/                  # Documentation
└── docker/                # Docker utilities

Troubleshooting

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

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests when relevant
  4. Submit a pull request

License

MIT License © Shogun contributors. See LICENSE.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages