Storage Providers
Engram relies on a provider implementing:
store(data, policy)retrieve(cid)renew(cid, policy)
Provider Selection
Use createProvider(name?) from @engram-sdk/providers.
ts
import { createProvider } from '@engram-sdk/providers'
const provider = await createProvider('synapse')Supported names:
synapse(default)storachamock
Synapse Provider
SynapseProvider targets Filecoin Onchain Cloud, supports replication hints, and handles deal submission for live usage.
Recommended for:
- production storage
- testnet integration validation
- realistic spend and retrieval behavior
Typical live env:
bash
ENGRAM_STORAGE_PROVIDER=synapse
OPERATOR_PRIVATE_KEY=0x...
ENGRAM_NETWORK=calibration
SYNAPSE_WITH_CDN=falseMock Provider
MockStorageProvider is deterministic and in-memory.
Recommended for:
- unit tests
- local development
- CI pipelines without chain credentials
You can simulate slower storage behavior for tests:
bash
MOCK_LATENCY_MS=200Storacha Provider
StorachaProvider is an IPFS-backed alternative and can be selected without changing app-level lifecycle code.
Required env:
bash
ENGRAM_STORAGE_PROVIDER=storacha
STORACHA_KEY=...
STORACHA_PROOF=...Notes:
- retrieval resolves through
https://w3s.link/ipfs/<cid> renewis a no-op in this provider implementation- useful for alternative persistence flows or integration experiments
Choosing a Provider Per Environment
| Environment | Provider | Why |
|---|---|---|
| Unit tests | mock | fast, deterministic |
| Local app dev | mock or synapse | choose speed vs realism |
| Staging | synapse on calibration | realistic ops with low risk |
| Production | synapse on mainnet | persistent and live |