Agent Guardrails Docs

Deployment Guide

End-to-end deployment from program to dashboard.

Deployment Sequence

  1. Build and deploy the Solana program
  2. Create Neon Postgres database
  3. Deploy the Express server
  4. Configure Helius webhook
  5. Deploy the Next.js dashboard

1. Program Deployment

terminal
cd program
anchor build
anchor deploy --provider.cluster devnet

Note the program ID from the output. Update GUARDRAILS_PROGRAM_ID in server/.env and dashboard/.env.local.

2. Database Setup

Create a Neon Postgres project at neon.tech. Get both the pooled and direct connection strings.

server/.env
DATABASE_URL=postgresql://user:pass@host/db?sslmode=require
DIRECT_URL=postgresql://user:pass@host/db?sslmode=require

Then run migrations:

terminal
cd server && npx prisma migrate deploy

3. Server Deployment

Configure the following environment variables on your hosting provider:

VariableRequiredDescription
PORTYesServer port (default 8080)
SOLANA_RPC_URLYesHelius devnet RPC endpoint
GUARDRAILS_PROGRAM_IDYesProgram ID from step 1
DATABASE_URLYesNeon pooled connection string
DIRECT_URLYesNeon direct connection string
JWT_SECRETYesRandom string, 32+ characters
CORS_ORIGINYesDashboard URL for CORS headers
MONITOR_KEYPAIRYesBase64-encoded monitor keypair
HELIUS_WEBHOOK_SECRETYesHMAC secret for webhook verification
ANTHROPIC_API_KEYOptionalRequired for AI judge verdicts
POLL_INTERVAL_MSOptionalPolling interval (default 30000)
terminal
cd server
pnpm install
pnpm build
pnpm start

4. Helius Webhook

Configure a Helius webhook to point to your server for real-time transaction monitoring:

  • URL: https://your-server.com/webhook
  • Transaction type: Enhanced
  • Account addresses: your program ID
  • Webhook type: enhanced
  • Set the HMAC secret to match your HELIUS_WEBHOOK_SECRET environment variable

5. Dashboard Deployment

Deploy the Next.js dashboard to Vercel with the following environment variables:

VariableDescription
NEXT_PUBLIC_SOLANA_RPC_URLHelius devnet RPC endpoint
NEXT_PUBLIC_GUARDRAILS_PROGRAM_IDProgram ID from step 1
NEXT_PUBLIC_API_URLServer URL from step 3
terminal
cd dashboard
npm install
npm run build

Verification Checklist

  1. Server health: curl https://your-server.com/api/session returns 401 (auth required means the server is running)
  2. Webhook: check server logs for [webhook] received messages
  3. Dashboard: navigate to the deployed URL, connect your wallet, and verify policies load
  4. End-to-end: run the demo setup and simulate an attack:
terminal
cd dashboard
npm run demo:setup
npm run demo:simulate
Never commit .env files or API keys. Use your hosting provider's secret management.