Vestige — Deployment
Components
| Component | Runtime | Notes |
|---|---|---|
apps/web |
Next.js 16 (Node ≥ 22) | Vercel or any Node host. Stateless; talks to Postgres (+ optional Redis). |
apps/worker |
Node ≥ 22 long-running process | Not serverless. One instance per egress IP (Hyperliquid rate limits are per IP). |
| PostgreSQL 15+ | managed | Migrations in packages/db/migrations (applied automatically by the worker on start, or pnpm db:migrate). |
| Redis 7 | optional | Caching + rate limits; everything falls back to in-memory without it. |
contracts/ |
Foundry | Elysium registry + soulbound passport (see step 5). |
Local development
pnpm install
bash scripts/services.sh start # project-local Postgres :55433 + Redis :63811 (data in .data/)
cp .env.example .env.local # then fill in values (see below); apps/web/.env.local is a symlink
pnpm db:migrate
pnpm dev:worker # indexer (discovers ~150 real wallets on first start)
pnpm dev:web # http://localhost:8780
pnpm test # core + SDK unit tests (vitest)
pnpm test:contracts # Foundry tests
Generate a development issuer key:
node -e "const {generatePrivateKey,privateKeyToAccount}=require('viem/accounts');const k=generatePrivateKey();console.log(k, privateKeyToAccount(k).address)"
Docker alternative for services: docker compose up -d postgres redis (see docker-compose.yml).
Environment variables
See .env.example for the full list. Essentials:
| Variable | Used by | Purpose |
|---|---|---|
DATABASE_URL |
web, worker | Postgres connection string |
REDIS_URL |
web | optional cache/rate-limit store |
NEXT_PUBLIC_SITE_URL |
web, worker | canonical origin (SIWE domain binding, links in credentials/OG images). Use https in production. |
SESSION_SECRET, IP_HASH_SALT |
web | per-environment secrets |
VESTIGE_ISSUER_ID, VESTIGE_ISSUER_NAME, VESTIGE_ISSUER_PRIVATE_KEY |
worker | credential issuer (replace the key with a KMS signer in production) |
HYPERLIQUID_API_URL, HYPERLIQUID_WS_URL, HYPERLIQUID_STATS_URL |
worker | data sources |
HL_WEIGHT_BUDGET_PER_MIN |
worker | request-weight budget (Hyperliquid allows 1,200/min per IP) |
DISCOVERY_ENABLED, DISCOVERY_MAX_WALLETS |
worker | seeding from the public leaderboard feed |
ANCHOR_NETWORK (none/elysium/elysium_testnet/local), ELYSIUM_RPC_URL, ELYSIUM_REGISTRY_ADDRESS, VESTIGE_ANCHOR_PRIVATE_KEY |
worker, web | onchain anchoring (the web reads the registry directly when verifying) |
ELYSIUM_PASSPORT_ADDRESS, ANCHOR_MIN_BALANCE_HYPE |
worker | owner-requested soulbound passport mints; balance reserve below which anchoring pauses (default 0.002) |
NEXT_PUBLIC_ELYSIUM_REGISTRY_ADDRESS, NEXT_PUBLIC_ELYSIUM_PASSPORT_ADDRESS |
web (build time) | public copy and explorer links; set only once the contracts are deployed and the worker is anchoring |
Production
- Database: create a managed Postgres; set
DATABASE_URL(use the pooled URL for the web app; postgres.js disables prepared statements automatically for pgbouncer/pooler URLs). - Worker: build
Dockerfile.worker(orpnpm --filter @vestige/worker start) on a small VM/container with the env above. It applies migrations, publishes methodology rows, registers the issuer and starts indexing. Health:system_kvkeyworker.heartbeatupdates every 30 s. - Web: deploy
apps/web(Vercel root directoryapps/web, install from the repo root with pnpm; buildnext build). Set the sameDATABASE_URL,REDIS_URL,NEXT_PUBLIC_SITE_URL, secrets. The web app never needs the issuer key. - Issuer key: move to KMS/HSM before issuing production credentials (SECURITY.md).
- Optional Elysium registry:
Addcd contracts export DEPLOYER_PRIVATE_KEY=… # funded with HYPE on Elysium export VESTIGE_ADMIN=<Safe address> VESTIGE_ISSUER=<issuer address> VESTIGE_ISSUER_NAME="Vestige Issuer" export VESTIGE_METHODOLOGY_VERSION=vrs-1.0.0 VESTIGE_METHODOLOGY_HASH=<content hash from /api/v1/methodologies> VESTIGE_METHODOLOGY_URI=https://<site>/docs/methodology forge script script/Deploy.s.sol --rpc-url elysium --broadcastDEPLOY_PASSPORT=true VESTIGE_PASSPORT_BASE_URI=https://<site>/api/nft/passport/to deploy the soulbound passport in the same broadcast. Then setANCHOR_NETWORK=elysium,ELYSIUM_REGISTRY_ADDRESS,ELYSIUM_PASSPORT_ADDRESSandVESTIGE_ANCHOR_PRIVATE_KEY(an active issuer, funded with HYPE) for the worker, andANCHOR_NETWORK,ELYSIUM_REGISTRY_ADDRESS,NEXT_PUBLIC_ELYSIUM_REGISTRY_ADDRESS,NEXT_PUBLIC_ELYSIUM_PASSPORT_ADDRESSfor the web (rebuild), and restart the worker. It verifies the chain id, contract code, issuer status and methodology publication, queues every current credential, and anchors them in batches of 40 (≈ 120k gas each — budget ≈ 0.00006 HYPE per credential at 0.5 gwei). Rehearse the whole path on anvil first withscripts/onchain-local.ts. Verify the source on the Elysium explorer (https://elysium.kinetiq.xyz/explorer, confirm the verifier settings on its Verify page first).
Scaling notes
- Throughput is bounded by Hyperliquid's per-IP request weight: add worker instances on separate IPs and shard by
address hash if needed (the job queue already supports multiple consumers via
SKIP LOCKED). - Fills dominate storage (~200 bytes/row). Partition
fillsby month once it exceeds ~100M rows. - Leaderboards and stats are snapshot/cached; API reads are single-row lookups on
trader_stats.