Configuration
MemForks resolves configuration from environment variables, local project config, and user credentials. The goal is to keep secrets out of source control while making SDK and CLI calls work with no copy-paste.
Resolution Order
The SDK and CLI resolve values in this order:
- Environment variables, such as
MEMFORK_TREE_ID. ~/.memfork/credentials.json, for user-global secrets..memfork/config.json, for project-local non-secret config.
Environment variables win because they are best for CI, containers, and hosted apps.
Project Config
.memfork/config.json stores project-level values:
{
"treeId": "0x...",
"network": "testnet",
"defaultBranch": "main"
}This file is safe to commit if it contains only non-secret project metadata. The current repository ignores .memfork/ by default, so decide deliberately whether your project wants to share this file.
Optional fields:
rpcUrl— custom Sui RPC endpoint.packageId— custom MemForks Move package ID.sponsorUrl— gas sponsorship endpoint.
User Credentials
~/.memfork/credentials.json stores private material and must never be committed.
{
"default": "0x<treeId>",
"trees": {
"0x<treeId>": {
"privateKey": "suiprivkey1...",
"memwalAccountId": "0x...",
"memwalKey": "<delegate-key-hex>"
}
}
}The file should have 0600 permissions. memfork doctor checks this.
Environment Variables
Use these for hosted apps and CI:
export MEMFORK_TREE_ID=0x...
export MEMFORK_PRIVATE_KEY=suiprivkey1...
export MEMFORK_NETWORK=testnet
export MEMFORK_MEMWAL_ACCOUNT=0x...
export MEMFORK_MEMWAL_KEY=<delegate-key-hex>
export MEMFORK_RELAYER_URL=https://relayer.memory.walrus.xyzOptional:
export MEMFORK_RPC_URL=https://fullnode.testnet.sui.io:443
export MEMFORK_PACKAGE_ID=0x...
export MEMFORK_SPONSOR_URL=https://sponsor.example.comNetwork Defaults
| Network | MemWal relayer |
|---|---|
testnet | https://relayer-staging.memory.walrus.xyz |
mainnet | https://relayer.memory.walrus.xyz |
The SDK picks a default relayer for the configured network unless MEMFORK_RELAYER_URL is set.
Hosted Apps
For Next.js, Vercel, Railway, or another hosted environment:
- Run
memfork init --quicklocally to provision testnet credentials. - Run
memfork doctor --env. - Copy the printed values into your host's secret manager.
- Add
OPENAI_API_KEYor your model provider key separately.
Never put MEMFORK_PRIVATE_KEY or MEMFORK_MEMWAL_KEY in client-side code. Keep MemForks writes on the server.
Common Checks
memfork doctor
memfork status
memfork log --branch mainIf an SDK call fails with missing config, run memfork doctor --env and compare the printed values with your runtime environment.