Complete deployment guide for production environment.
- All
.envfiles configured with production values -
HELIUS_API_KEYset (production key) -
SOLANA_NETWORKset (mainnet or devnet) -
ANCHOR_WALLETpath configured -
DATABASE_URLconfigured (production database) -
REDIS_URLconfigured (production Redis) - All secrets stored securely (not in git)
- All tests passing (
bun test) - No linter errors
- Code reviewed
- README.md updated
- LICENSE file present
- Program built successfully (
anchor build) - Tests passing (
anchor test) - Program deployed to target network
- Program ID updated in
.envand code - Program verified on explorer
- Vercel account created
- Vercel CLI installed (
npm i -g vercel)
-
Configure Vercel Project
cd packages/frontend vercel login vercel link -
Set Environment Variables in Vercel Dashboard
PUBLIC_API_BASE_URL- Your production API URL- Any other public env vars
-
Deploy
vercel --prod
-
Verify
- Frontend accessible at production URL
- API calls working
- Tailwind styles loading
- No console errors
{
"buildCommand": "cd packages/frontend && bun install && bun run build",
"outputDirectory": "packages/frontend/dist",
"framework": "astro",
"env": {
"PUBLIC_API_BASE_URL": "@api_base_url"
}
}- VPS server (Ubuntu 22.04+)
- Docker and Docker Compose installed
- Domain name configured (optional)
- SSL certificate (Let's Encrypt)
-
Clone Repository
git clone https://github.com/yourusername/haveibeendrained.git cd haveibeendrained -
Configure Production Environment
# Copy and edit production env files cp .env.example .env cp packages/api/.env.example packages/api/.env # Edit with production values nano .env nano packages/api/.env
-
Update docker-compose.yml for Production
- Remove development volumes
- Set proper restart policies
- Configure health checks
- Set up reverse proxy (Nginx)
-
Start Services
docker compose -f docker-compose.prod.yml up -d
-
Set Up Reverse Proxy (Nginx)
server { listen 80; server_name api.yourdomain.com; location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
-
SSL Certificate (Let's Encrypt)
sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d api.yourdomain.com
-
Verify
- API health endpoint responding
- Analyze endpoint working
- Report endpoints working
- CORS configured correctly
-
Connect Repository
- Link GitHub repo to platform
-
Configure Build
- Root directory:
packages/api - Build command:
bun install && bun run build - Start command:
bun run start
- Root directory:
-
Set Environment Variables
- All required env vars from
.env.example
- All required env vars from
-
Deploy
- Push to main branch triggers deployment
-
Production Database
- Database created
- User and password configured
- Connection string in
DATABASE_URL - Backups configured
-
Run Migrations (if using Drizzle)
cd packages/api bun run db:migrate -
Verify Connection
docker exec -it haveibeendrained-postgres psql -U postgres -d haveibeendrained
-
Production Redis
- Redis instance created
- Connection string in
REDIS_URL - Persistence configured (AOF)
- Memory limits set
-
Verify Connection
docker exec -it haveibeendrained-redis redis-cli ping
-
Configure Anchor.toml
[programs.devnet] drainer_registry = "YOUR_PROGRAM_ID"
-
Deploy
cd packages/anchor anchor deploy --provider.cluster devnet -
Verify
- Program visible on Solana Explorer
- Can call instructions
- Program ID saved in
.env
-
Switch to Mainnet
solana config set --url https://api.mainnet-beta.solana.com -
Fund Wallet
# Ensure wallet has SOL for deployment fees solana balance -
Update Anchor.toml
[programs.mainnet] drainer_registry = "YOUR_PROGRAM_ID"
-
Deploy
anchor deploy --provider.cluster mainnet
-
Verify
- Program on mainnet explorer
- Test with small transaction first
- Monitor for issues
- All API keys rotated for production
- Database credentials secure
- Redis password set (if exposed)
- CORS configured correctly
- Rate limiting enabled
- HTTPS enforced
- Security headers configured
- Error messages don't leak sensitive info
- Wallet private keys never committed
-
.envfiles in.gitignore
- Health check endpoints configured
- Logging configured (structured logs)
- Error tracking (Sentry, etc.)
- Uptime monitoring
- Performance monitoring
- Database monitoring
- Redis monitoring
- Homepage loads
- Wallet input works
- Analysis completes successfully
- Results display correctly
- Mobile responsive
- No console errors
- Health endpoint:
GET /api/health - Analyze endpoint:
GET /api/analyze?address=... - Report query:
GET /api/report/:address - Report submit:
POST /api/report - Error handling works
- Rate limiting works
- Can query drainer reports
- Can submit reports (test with devnet)
- Known drainer detection works
- Transaction signatures valid
If deployment fails:
-
Frontend (Vercel)
vercel rollback
-
API (Docker)
docker compose down git checkout previous-version docker compose up -d
-
Database
- Restore from backup if needed
After deployment, update these:
- Frontend URL:
https://yourdomain.com - API URL:
https://api.yourdomain.com - Program Explorer:
https://explorer.solana.com/address/... - GitHub repo:
https://github.com/... - Demo video:
https://youtube.com/...
- All services running
- All tests passing
- Documentation updated
- README.md has correct URLs
- Demo video recorded
- Hackathon submission ready
- Social media posts prepared
Last Updated: December 2025
For: Solana Student Hackathon Fall 2025