This is the repository for the IPFS Pinning Service API that runs at https://api1.cloud.fx.land. The requests are distributed through https://api.cloud.fx.land which runs the code inside pool-server.
- SQLite Backend: Fast, lightweight local database with WAL mode for optimal concurrency
- IPFS Pinning API Compliant: Follows the IPFS Pinning Service API Specification
- Production Ready: Comprehensive error handling, input validation, and graceful shutdown
- Low Resource Usage: Optimized for minimal memory footprint
- Go 1.22+
- IPFS node (Kubo) running locally
- IPFS Cluster (optional, for distributed pinning)
Run the installation script as root:
sudo ./install.shThe script will:
- Prompt for configuration values (with defaults from existing
.envif upgrading) - Build the application
- Create the systemd service
- Start the service
Default installation directory: /home/root/pinning-service
- Build the application:
go build -o ./ipfs-pinning main_sqlite.go- Create configuration file:
cp .env.example .env
# Edit .env with your configuration- Create data directory:
mkdir -p data- Copy service file:
sudo cp ipfs-server/fula-pinning-service.service /etc/systemd/system/- Enable and start service:
sudo systemctl daemon-reload
sudo systemctl enable fula-pinning-service
sudo systemctl start fula-pinning-serviceEdit .env file with your settings:
# Server Configuration
PORT=6000
# Database Configuration (SQLite)
DATABASE_PATH=data/pinning.db
# IPFS Configuration
IPFS_API_ADDR=/ip4/127.0.0.1/tcp/5001
# Blockchain Configuration
BLOCKCHAIN_API_ENDPOINT=http://your-blockchain-api
MASTER_SEED=your_master_seed
POOL_SEED=your_pool_seed
POOL_ID=1The SQLite database includes the following optimized tables:
- users: User accounts with password hashes and pool assignments
- sessions: Active user sessions for authentication
- pins: Pin records with CID, metadata, and status tracking
- logins: Audit log for login attempts (security monitoring)
All tables have appropriate indexes for fast queries.
POST /pins- Add a new pinGET /pins- List pins with filteringGET /pins/{requestid}- Get pin by request IDPOST /pins/{requestid}- Replace a pinDELETE /pins/{requestid}- Delete a pin
POST /auth/register- Register new userPOST /auth/login- Login and get session tokenPOST /auth/logout- Logout and invalidate session
These endpoints require X-System-Key header or Authorization: Bearer <SYSTEM_KEY> for authentication.
GET /admin/pins/pending?after=2024-01-01T00:00:00Z&before=2024-12-31T23:59:59Z&username=user@example.com&limit=200&status=pending
| Parameter | Required | Default | Description |
|---|---|---|---|
after |
Yes | - | Start time filter (RFC3339) |
before |
No | - | End time filter (RFC3339) |
username |
No | - | Filter by username |
limit |
No | 200 | Max results (1-1000) |
status |
No | pending | Status filter: pending, queued, pinning, pinned, failed |
POST /admin/pins/status
Content-Type: application/json
{
"updates": [
{"cid": "Qm...", "status": "pinned"},
{"cid": "Qm...", "upload_status": "uploaded"}
]
}
POST /admin/pins/size
Content-Type: application/json
{
"updates": [
{"cid": "Qm...", "size": 12345678}
]
}
GET /admin/stats
Returns total storage used by a user across all their sessions/API keys.
GET /admin/storage/user/{username}
Response includes session breakdown showing storage per API key.
Returns storage used by a specific session token.
GET /admin/storage/session/{token}
GET /admin/storage
# View service status
sudo systemctl status fula-pinning-service
# View logs
sudo journalctl -u fula-pinning-service -f
# Restart service
sudo systemctl restart fula-pinning-service
# Stop service
sudo systemctl stop fula-pinning-servicecd openapi/go
go test -v ./...cd openapi/go
go test -bench=. -benchmem ./...The service supports a test mode for running the official IPFS Pinning Service compliance tests.
Prerequisites:
- IPFS daemon running locally (
ipfs daemon) - Node.js installed (for npx)
Step 1: Start the service in test mode
Windows (PowerShell):
.\run-test-mode.ps1Linux/Mac:
./run-test-mode.shOr manually:
TEST_MODE=true go run main_sqlite.goStep 2: Run the compliance tests (in another terminal)
npx @ipfs-shipyard/pinning-service-compliance -s http://localhost:6000 test-token-for-ipfs-pinning-complianceTest Mode Details:
- Creates a test user:
test@pinning.local - Uses a fixed token:
test-token-for-ipfs-pinning-compliance - Uses a separate test database:
data/pinning_test.db - All operations are real (actual IPFS pinning, real database storage)
The installation script supports upgrades:
- Run
sudo ./install.sh - The script will detect the existing installation
- Creates a backup before upgrading
- Preserves your
.envconfiguration - Restarts the service with new binary
The original Firebase backend is still available in main.go. To use it:
go build -o ./ipfs-pinning main.goNote: Firebase backend requires GOOGLE_APPLICATION_CREDENTIALS environment variable.