Self-hosting
Run the whole stack locally, or deploy your own facilitator, indexer and dashboard.
The hosted services are a convenience. Each one is open source, and none holds keys that control your wallet, so you can run any of them yourself.
Run everything locally
Prerequisites: Node.js 22+, pnpm 10+, Rust 1.84+ with the wasm32v1-none target, and stellar-cli 28+. No Docker needed: without DATABASE_URL, the indexer uses an embedded Postgres (PGlite).
git clone https://github.com/martins-ngene/kryptwarden.git
cd kryptwarden
pnpm install
# Contract and TypeScript tests
pnpm test:contracts
pnpm test
# Deploy fresh Testnet contracts, fund a 50 USDC demo wallet, write .env
node scripts/deploy-testnet.mjs
# Facilitator :4020, demo APIs :4021, indexer :4022, dashboard :3000
pnpm build
pnpm devOpen http://localhost:3000. The generated .env points the dashboard and SDK at your local services.
Run the full six-step end-to-end check against your stack:
node --env-file=.env scripts/verify-e2e-testnet.mjsConfiguration
Facilitator (packages/facilitator)
| Variable | Default | |
|---|---|---|
FACILITATOR_SIGNER_SECRET | required | S… secret of a funded account that pays fees. Keep it secret |
FACILITATOR_PORT | 4020 | |
STELLAR_NETWORK | stellar:testnet | |
STELLAR_RPC_URL | network default | |
FACILITATOR_MAX_TX_FEE_STROOPS | 2000000 | Fee ceiling; custom accounts need more than the usual 50,000 |
FACILITATOR_INCLUSION_FEE_STROOPS | 1000 | |
RELAYER_MAX_HOLDS_PER_AGENT_PER_MIN | 8 | Per-agent rate limit on /relayer/* |
RELAYER_DAILY_XLM_BUDGET_STROOPS | 500000000 (50 XLM) | Daily cap on sponsored fees |
ALLOWED_ORIGINS | allow all | Comma-separated CORS origins |
Indexer (packages/indexer)
| Variable | Default | |
|---|---|---|
DATABASE_URL | none (PGlite) | Postgres connection string |
PGLITE_DATA_DIR | in-memory | Where PGlite stores data when there's no DATABASE_URL |
INDEXER_PORT | 4022 | |
STELLAR_RPC_URL, STELLAR_NETWORK_PASSPHRASE | Testnet | |
USDC_SAC_CONTRACT_ID | Circle Testnet USDC | |
SELLER_*_PUBLIC_KEY | none | Display names for the demo sellers |
KRYPTWARDEN_DEMO_WALLET_ID | none | Wallet to track from start-up |
ALLOWED_ORIGINS | allow all |
Demo sellers (packages/demo-apis)
| Variable | |
|---|---|
SELLER_SEARCH_PUBLIC_KEY, SELLER_LLM_PUBLIC_KEY, SELLER_DATA_PUBLIC_KEY, SELLER_UNLISTED_SCRAPE_PUBLIC_KEY | Payee addresses. If any is missing, /paid/* returns 503 (fails closed) |
FACILITATOR_URL | Default http://localhost:4020 |
DEMO_APIS_PORT | Default 4021 |
Dashboard (apps/web)
NEXT_PUBLIC_* values are fixed when the app is built, so rebuild after changing them.
| Variable | |
|---|---|
NEXT_PUBLIC_INDEXER_API_URL | Spend API base URL |
NEXT_PUBLIC_FACTORY_CONTRACT_ID, NEXT_PUBLIC_USDC_SAC_CONTRACT_ID | Contracts |
NEXT_PUBLIC_DEMO_WALLET_ID, NEXT_PUBLIC_DEMO_AGENT_PUBLIC_KEY | Wallet shown to visitors who aren't connected |
NEXT_PUBLIC_SELLER_*_ADDRESS | Sellers offered in Register Agent |
NEXT_PUBLIC_STELLAR_RPC_URL, NEXT_PUBLIC_STELLAR_HORIZON_URL | Network endpoints |
Deploying
The hosted stack uses:
- Fly.io for the facilitator, indexer and demo sellers, from
Dockerfile.serviceswith onefly.<service>.tomleach, plus Fly Managed Postgres for the indexer. - Vercel for the dashboard (
apps/web) and this portal (apps/docs). - GitHub Actions to test on every push, and on
v*tags to attest and release the contract WASMs, deploy the services and publish the SDK to npm with provenance.
Step-by-step Fly instructions are in docs/DEPLOY_FLY.md.
Pointing agents at your stack
const kw = createKryptWarden({
walletAddress,
agentSecretKey,
relayerUrl: "https://pay.example.com", // or set FACILITATOR_URL
});Sellers point their x402 middleware at your facilitator URL.