Skip to Content
KryptWarden Developers

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 dev

Open 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.mjs

Configuration

Facilitator (packages/facilitator)

VariableDefault
FACILITATOR_SIGNER_SECRETrequiredS… secret of a funded account that pays fees. Keep it secret
FACILITATOR_PORT4020
STELLAR_NETWORKstellar:testnet
STELLAR_RPC_URLnetwork default
FACILITATOR_MAX_TX_FEE_STROOPS2000000Fee ceiling; custom accounts need more than the usual 50,000
FACILITATOR_INCLUSION_FEE_STROOPS1000
RELAYER_MAX_HOLDS_PER_AGENT_PER_MIN8Per-agent rate limit on /relayer/*
RELAYER_DAILY_XLM_BUDGET_STROOPS500000000 (50 XLM)Daily cap on sponsored fees
ALLOWED_ORIGINSallow allComma-separated CORS origins

Indexer (packages/indexer)

VariableDefault
DATABASE_URLnone (PGlite)Postgres connection string
PGLITE_DATA_DIRin-memoryWhere PGlite stores data when there's no DATABASE_URL
INDEXER_PORT4022
STELLAR_RPC_URL, STELLAR_NETWORK_PASSPHRASETestnet
USDC_SAC_CONTRACT_IDCircle Testnet USDC
SELLER_*_PUBLIC_KEYnoneDisplay names for the demo sellers
KRYPTWARDEN_DEMO_WALLET_IDnoneWallet to track from start-up
ALLOWED_ORIGINSallow all

Demo sellers (packages/demo-apis)

Variable
SELLER_SEARCH_PUBLIC_KEY, SELLER_LLM_PUBLIC_KEY, SELLER_DATA_PUBLIC_KEY, SELLER_UNLISTED_SCRAPE_PUBLIC_KEYPayee addresses. If any is missing, /paid/* returns 503 (fails closed)
FACILITATOR_URLDefault http://localhost:4020
DEMO_APIS_PORTDefault 4021

Dashboard (apps/web)

NEXT_PUBLIC_* values are fixed when the app is built, so rebuild after changing them.

Variable
NEXT_PUBLIC_INDEXER_API_URLSpend API base URL
NEXT_PUBLIC_FACTORY_CONTRACT_ID, NEXT_PUBLIC_USDC_SAC_CONTRACT_IDContracts
NEXT_PUBLIC_DEMO_WALLET_ID, NEXT_PUBLIC_DEMO_AGENT_PUBLIC_KEYWallet shown to visitors who aren't connected
NEXT_PUBLIC_SELLER_*_ADDRESSSellers offered in Register Agent
NEXT_PUBLIC_STELLAR_RPC_URL, NEXT_PUBLIC_STELLAR_HORIZON_URLNetwork endpoints

Deploying

The hosted stack uses:

  • Fly.io for the facilitator, indexer and demo sellers, from Dockerfile.services with one fly.<service>.toml each, 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.

On this page