Hive is a local IPFS-to-Swarm bridge and cache.
It sits in front of an IPFS node and a Bee node, mirrors IPFS content into Swarm, and keeps a Hyperdrive-backed local cache so content can still be served when one upstream goes away.
IPFS uploads:
POST /api/v0/addproxies to Kubo- Hive extracts returned CIDs
- the uploaded content is cached locally
- the same content is uploaded to Bee
- Hive stores a
CID -> bzz hashbridge mapping
IPFS reads:
GET /ipfs/<cid>is Swarm-first when a bridge mapping exists- if Bee is unavailable, Hive falls back to local cache
- if neither mapping nor local cache exists, Hive falls back to the IPFS gateway
- successful gateway reads are cached and bridged to Swarm
Swarm uploads:
POST /bzzproxies to Bee withswarm-pin: true- Hive caches the uploaded bytes locally
- Swarm uploads are not bridged back into IPFS
Swarm reads:
GET /bzz/<hash>serves from Bee first- successful Bee reads are cached locally in Hive
- if Bee is unavailable, Hive falls back to the local cached copy
Response headers:
x-content-origin: hivemeans the response came from the local Hyperdrive cachex-content-origin: swarmmeans the response came from Bee/Swarm, including IPFS bridge hitsx-content-origin: ipfsmeans the response came from an upstream IPFS gateway or Kubo RPC
Core pieces:
IdentityService: owns the local Corestore and HyperdriveDriveService: stores content, metadata, and protocol referencesFileIndexService: keeps fast in-memory bridge lookups for active runtime useSwarmBridgeService: uploads mirrored IPFS content to Bee and resolvesCID -> bzzIpfsService: handles/ipfs/*,/ipns/*, and/api/v0/*EthswarmService: handles/bzz/*,/bytes/*, and/chunks/*
Local storage layout:
/content/<checksum>raw bytes/meta/<checksum>.jsonmetadata/refs/ipfs/<cid>CID to checksum/refs/bzz/<hash>bzz hash to checksum/refs/bridge/ipfs/<cid>CID to bridged bzz hash
Hive endpoints:
GET /hive/statusPOST /hive/storage/purgeGET /hive/listGET /hive/lsGET /hive/ls/:pathGET /hive/content/:checksumGET /hive/meta/:checksumGET /hive/feed/localPOST /hive/contentPOST /hive/driveDELETE /hive/content/:checksum
Proxy endpoints:
GET /ipfs/*ALL /ipns/*ALL /api/v0/*GET /bzz/*POST /bzzPOST /bzz/*GET /bytes/*POST /bytesGET /chunks/*POST /chunks
Required variables:
STORAGE_PATHBEE_API_URLBEE_POSTAGE_STAMPIPFS_GATEWAY_URLIPFS_API_URLUPSTREAM_TIMEOUT
Optional variables:
NODE_IDdefaultHIVEPORTdefault4774BODY_LIMITdefault1073741824
See .env.example for a full runnable template.
Install:
pnpm installRun locally:
pnpm start:devOpen API docs:
http://localhost:4774/hive/docs/api
Unit tests:
pnpm testE2E tests:
pnpm test:e2eThe e2e suite uses real upstream nodes.
Expected environment:
BEE_API_URL,BEE_POSTAGE_STAMP,IPFS_GATEWAY_URL, andIPFS_API_URLpoint to running Bee and Kubo nodes- optional
E2E_BEE_API_URL,E2E_BEE_POSTAGE_STAMP,E2E_IPFS_GATEWAY_URL, andE2E_IPFS_API_URLcan override the normal runtime values for tests only
What it verifies:
- IPFS upload through Hive creates a real CID, Hive serves that CID, and after Hive is restarted with IPFS pointed at an unreachable URL the same CID is still served via the real Swarm bridge
- Swarm upload through Hive creates a real Bee reference, Hive serves that reference, and after Hive is restarted with Bee pointed at an unreachable URL the same reference is still served from Hive's local cache
Lint and format checks:
pnpm checkBuild:
pnpm build