Deployment Guide
End-to-end deployment from program to dashboard.
Deployment Sequence
- Build and deploy the Solana program
- Create Neon Postgres database
- Deploy the Express server
- Configure Helius webhook
- Deploy the Next.js dashboard
1. Program Deployment
terminal
cd program
anchor build
anchor deploy --provider.cluster devnetNote 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=requireThen run migrations:
terminal
cd server && npx prisma migrate deploy3. Server Deployment
Configure the following environment variables on your hosting provider:
| Variable | Required | Description |
|---|---|---|
PORT | Yes | Server port (default 8080) |
SOLANA_RPC_URL | Yes | Helius devnet RPC endpoint |
GUARDRAILS_PROGRAM_ID | Yes | Program ID from step 1 |
DATABASE_URL | Yes | Neon pooled connection string |
DIRECT_URL | Yes | Neon direct connection string |
JWT_SECRET | Yes | Random string, 32+ characters |
CORS_ORIGIN | Yes | Dashboard URL for CORS headers |
MONITOR_KEYPAIR | Yes | Base64-encoded monitor keypair |
HELIUS_WEBHOOK_SECRET | Yes | HMAC secret for webhook verification |
ANTHROPIC_API_KEY | Optional | Required for AI judge verdicts |
POLL_INTERVAL_MS | Optional | Polling interval (default 30000) |
terminal
cd server
pnpm install
pnpm build
pnpm start4. 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_SECRETenvironment variable
5. Dashboard Deployment
Deploy the Next.js dashboard to Vercel with the following environment variables:
| Variable | Description |
|---|---|
NEXT_PUBLIC_SOLANA_RPC_URL | Helius devnet RPC endpoint |
NEXT_PUBLIC_GUARDRAILS_PROGRAM_ID | Program ID from step 1 |
NEXT_PUBLIC_API_URL | Server URL from step 3 |
terminal
cd dashboard
npm install
npm run buildVerification Checklist
- Server health:
curl https://your-server.com/api/sessionreturns 401 (auth required means the server is running) - Webhook: check server logs for
[webhook] receivedmessages - Dashboard: navigate to the deployed URL, connect your wallet, and verify policies load
- End-to-end: run the demo setup and simulate an attack:
terminal
cd dashboard
npm run demo:setup
npm run demo:simulateNever commit .env files or API keys. Use your hosting provider's secret management.