Self-Hosting Overview
Deploy Nexgent on your own infrastructure for complete control over your trading engine.
Why Self-Host?
| Benefit | Description |
|---|---|
| Full Control | Your data, your keys, your infrastructure |
| No Fees | Zero platform fees - only pay for hosting |
| Customization | Modify any part of the codebase |
| Privacy | Trading data never leaves your servers |
| Compliance | Meet regulatory requirements for data residency |
System Requirements
Minimum Requirements
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPUs |
| RAM | 0.5 GB | 1 GB |
| Storage | 0.5 GB SSD | 1 GB SSD |
| Network | 100 Mbps | 100 Mbps |
Software Requirements
| Software | Version | Purpose |
|---|---|---|
| Node.js | 18.0.0+ | Runtime |
| pnpm | 8.0.0+ | Package manager |
| PostgreSQL | 14+ | Database |
| Redis | 7+ | Caching & queues |
Architecture Overview
Nexgent consists of two main services:
┌─────────────────────────────────────────────────────────────┐
│ Your instance │
└─────────────────────────┬───────────────────────────────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Frontend │ │ Backend │
│ (Next.js) │──────▶│ (Express) │
│ │ API │ │
│ - Dashboard UI │◀──────│ - REST API │
│ - Real-time views │ WS │ - WebSocket │
│ - Auth pages │ │ - Trading engine │
└─────────────────────┘ └──────────┬──────────┘
│
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ Redis │ │ External APIs │
│ │ │ │ │ │
│ - Users │ │ - Cache │ │ - Jupiter │
│ - Agents │ │ - Sessions │ │ - Pyth │
│ - Positions │ │ - Job queues │ │ - Solana RPC │
└─────────────────┘ └─────────────────┘ └─────────────────┘Deployment Options
Choose the deployment method that fits your needs:
Comparison
| Feature | Docker Compose | Vercel + Railway | VPS |
|---|---|---|---|
| Setup Time | 15 minutes | 30 minutes | 1-2 hours |
| Cost | VPS cost only | Free tier available | VPS cost only |
| Scaling | Manual | Automatic | Manual |
| SSL | Manual setup | Automatic | Manual setup |
| Best For | Dev/Testing | Production | Full control |
Required External Services
Regardless of deployment method, you'll need:
1. Jupiter API Key (Required)
- Purpose: Token swaps and price quotes
- Get it: jup.ag/api (opens in a new tab)
- Cost: Free
2. Trading Wallets (Required for Live Trading)
- Purpose: Execute trades on-chain
- Setup: Generate Solana keypairs
- Security: Store private keys securely in environment variables
⚠️
Security: Never commit private keys to version control. Use environment variables or secrets management.
Pre-Deployment Checklist
Before deploying, ensure you have:
- PostgreSQL database provisioned
- Redis instance provisioned
- Jupiter API key obtained
- Trading wallet keypairs generated (for live trading)
- Domain name configured (for production)
- SSL certificate (for production)
Environment Variables
All deployment methods require environment variables. Key variables include:
Backend
# Database
DATABASE_URL="postgresql://user:pass@host:5432/nexgent"
# Redis
REDIS_HOST=your-redis-host
REDIS_PORT=6379
REDIS_PASSWORD=your-redis-password
# Server
PORT=4000
NODE_ENV=production
CORS_ORIGIN=https://your-frontend-domain.com
# Auth
JWT_SECRET=your-secure-jwt-secret
# Admin login credentials
ADMIN_EMAIL=admin@yourdomain.com
ADMIN_PASSWORD=your-secure-admin-password
# External APIs
JUPITER_API_KEY=your-jupiter-api-key
SOLANA_RPC_URL=https://your-rpc-endpointFrontend
# NextAuth.js
NEXTAUTH_URL=https://your-frontend-domain.com
NEXTAUTH_SECRET=your-secure-nextauth-secret
# Backend API
NEXT_PUBLIC_API_URL=https://your-backend-domain.comSee Environment Variables for a complete reference.
Quick Start
For the fastest path to deployment:
- Production (recommended): Use Railway — one-click deploy, no infra setup. See Quickstart (Cloud Hosting) for the full guide.
- Development/Testing: Use Docker Compose
- Production (split stack): Use Vercel + Railway
Railway and Docker Compose can be set up in under 30 minutes.