Skip to main content
Documentation

Self-Host Agentbot

Agentbot is MIT licensed and can run on your own stack. This guide covers the practical path: Next.js frontend, PostgreSQL, the Agentbot backend, and the environment you need for channels, auth, billing, and production operations.

Frontend
Next.js 16
web/
Backend
Express
agentbot-backend/
Database
PostgreSQL 15+
Prisma-managed schema

Minimum Requirements

  • Node.js 20+
  • PostgreSQL 15+ or a managed Postgres service like Neon
  • 1 GB RAM per concurrent agent container as a realistic floor
  • Docker if you want isolated runtime containers beyond the web/control plane
  • API keys for the providers you actually enable: Google/GitHub auth, OpenRouter/OpenAI, Stripe, Resend, Telegram, etc.

Recommended Topology

1. Web App

Deploy `web/` as the product surface and API routes. In production it builds with `next build --webpack` and runs from `.next/standalone/server.js`.

2. Backend

Deploy `agentbot-backend/` separately for provisioning, runtime control, and backend-only services.

3. Postgres

Use one shared database for users, sessions, agents, skills, claims, and dashboards.

Quick Start

Clone and install
git clone https://github.com/Eskyee/agentbot-opensource.git
cd agentbot-opensource

cd web
npm install

cd ../agentbot-backend
npm install
Set environment variables
# web/.env
DATABASE_URL=postgresql://...
NEXTAUTH_SECRET=...
NEXTAUTH_URL=https://your-domain
BACKEND_API_URL=https://your-backend-domain
INTERNAL_API_KEY=...

# Optional by feature:
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...
OPENROUTER_API_KEY=...
STRIPE_SECRET_KEY=...
STRIPE_WEBHOOK_SECRET=...
RESEND_API_KEY=...
ADMIN_EMAILS=you@example.com

# agentbot-backend/.env
DATABASE_URL=postgresql://...
PORT=4000
JWT_SECRET=...
INTERNAL_API_KEY=...
Generate Prisma and run the app
cd web
npx prisma generate
npx prisma migrate deploy
npm run build
npm run start

cd ../agentbot-backend
npm run build
npm run start

Production Contract

  • `web/` must keep the `next build --webpack` build contract.
  • `web/` production runtime is `node .next/standalone/server.js`.
  • Use Prisma migrations or controlled raw SQL for schema changes that hit production routes.
  • Do not hide runtime failures behind mock success data on production dashboards.

Feature Flags And Optional Services

Payments & Billing

Stripe is optional for self-hosting. If you do not set Stripe keys, billing and checkout routes should stay disabled or internal-only.

Channels

Telegram, Discord, WhatsApp, Resend, and similar channel integrations only need env values if you plan to enable them.

KV / Cron Automation

Auto-blog and social cron features benefit from Upstash KV plus a `CRON_SECRET`. Without KV, those routes should degrade gracefully.

Managed Runtime Controls

If you are not using Railway-managed runtimes, keep the web app deployed and disable or replace instance-control actions with your own orchestration.

Security Checklist

  • Set `NEXTAUTH_SECRET` and backend secrets before exposing the app publicly.
  • Lock `ADMIN_EMAILS` to known operators only.
  • Do not leave demo or development routes enabled in production unless you explicitly intend to.
  • Run `npm audit`, lint, and `npm run build` before each production release.
  • Use TLS on both the web app and backend. Never expose internal control routes on plain HTTP.

What This Guide Does Not Assume

This guide does not assume Vercel, Railway, or any specific cloud vendor. The managed Agentbot product uses those platforms, but the self-host path is simply: run the Next.js app, run the backend, connect PostgreSQL, and only enable the integrations you actually need.

Next Steps

ONLINE
© 2026 Agentbot