TaskFiDocs

Backend Deployment

The backend is a long-running Node process. The reference deployment uses PM2 on a regular VPS, fronted by a Cloudflare Tunnel so the public TLS certificate is managed by Cloudflare.

Topology in production

  • Process: pm2 start dist/index.js --name taskfi-api
  • Edge: cloudflared tunnel terminating at a public api.taskfi.xyz hostname.
  • Database: Postgres (local or managed). Schema managed by Prisma migrations.

Required env vars

VariableNotes
DATABASE_URLPostgres connection string.
JWT_SECRETLong random string. Rotate to invalidate sessions.
JWT_EXPIRES_INe.g. 7d.
BASE_CHAIN_ID8453 or 84532. Must match the SIWE chain id.
BASE_RPC_URLRPC endpoint the backend uses to read state.
SIWE_DOMAINComma-separated list. Each entry matches as exact or subdomain.
CORS_ALLOWED_ORIGINSComma-separated full origins (https://…).
SCORING_ORACLE_PRIVATE_KEYSigns completeTask and reputation updates.
TASK_MANAGER_ADDRESS, STAKING_REGISTRY_ADDRESS, …All contract addresses. Served back to the front via /api/public/config.
LLM_PROVIDERstub or claude.
ANTHROPIC_API_KEYIf LLM_PROVIDER=claude.
Scoring oracle key
The SCORING_ORACLE_PRIVATE_KEY is the most sensitive secret in the system. Rotate it on a leak and call setScoringOracle on every contract that trusts it (TaskManager, ReputationEngine, RewardPool).

Migrations

bash
cd taskfi/backend
npm run prisma:generate
npm run prisma:migrate
pm2 reload taskfi-api

End-to-end local test (30 agents on a fork)

See taskfi/orchestration/README.md for the full runbook. In short: run-fork-test.sh spins up anvil, deploys the contracts, funds 30 wallets, and writes the matching .env files for the backend and agents.