Skip to content

AgentaFlow/agentbase

Repository files navigation

Agentbase

Similar to WordPress, made for AI Native Applications β€” Build, deploy, and manage AI-powered applications without the complexity.

Agentbase is an open-source platform that brings the WordPress model to AI development: plugins, themes, a marketplace, and a hosted option β€” everything you need to launch AI products fast.

License: GPL v3 pnpm Documentation

πŸ“– Full documentation is available at agentaflow.github.io/agentbase β€” covering self-hosting, plugin & theme development, AI model configuration, and the full API reference.

Screenshots

AI-Native Platform

AI-Native β€” Built from the ground up for AI-first applications

Agentbase User Testing

Application Dashboard β€” Managing AI applications, plugins, and configurations

Chat Application

Chat Application β€” Fully functional AI chat app powered by your chosen model

Create Application

Create Application β€” Quickly scaffold and configure a new AI application

Architecture

agentbase/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ core/              # NestJS API (PostgreSQL + MongoDB)
β”‚   β”œβ”€β”€ frontend/          # Next.js 14 (App Router + Tailwind)
β”‚   β”œβ”€β”€ ai-service/        # FastAPI (AI provider integrations + SSE streaming)
β”‚   β”œβ”€β”€ installer/         # Self-hosted CLI installer (Commander + Inquirer)
β”‚   β”œβ”€β”€ shared/            # Shared TypeScript types
β”‚   β”œβ”€β”€ plugins/           # Plugin SDK + examples
β”‚   └── themes/            # Theme SDK + starter themes
β”œβ”€β”€ docs/                  # Documentation site (Nextra)
β”œβ”€β”€ docker-compose.yml     # Local dev databases
β”œβ”€β”€ docker-compose.prod.yml # Production stack
└── .env.example           # Environment template

Tech Stack

Layer Technology
Core API Node.js + NestJS + TypeORM
Frontend Next.js 14 + React + Tailwind CSS
AI Service Python + FastAPI
SQL Database PostgreSQL 16
Document DB MongoDB 7
Cache Redis 7
Infrastructure Docker, Nginx, DigitalOcean Kubernetes (DOKS)
License GPL-3.0

Quick Start

Prerequisites

  • Node.js 20+
  • Python 3.11+
  • Docker & Docker Compose
  • pnpm 9+

Setup

# Clone the repo
git clone https://github.com/agentaflow/agentbase.git
cd agentbase

# Copy environment variables
cp .env.example .env

# Start databases
docker compose up -d

# Install dependencies
pnpm install

# Start all services
pnpm dev

Services will be available at:

Start Individual Services

pnpm dev:core       # NestJS API only
pnpm dev:frontend   # Next.js frontend only
pnpm dev:ai         # FastAPI AI service only

Self-Hosted Installation

For production self-hosted deployments, use the CLI installer:

cd packages/installer
pnpm install
npx ts-node src/cli.ts check     # Verify system requirements
npx ts-node src/cli.ts install   # Interactive installation wizard
npx ts-node src/cli.ts status    # Check service status
npx ts-node src/cli.ts update    # Update to latest version

Features

πŸ€– AI Integration

  • Multi-Provider Support β€” OpenAI (GPT-4, GPT-4o, GPT-3.5), Anthropic (Claude), Google Gemini (2.0 Flash, 1.5 Pro, 1.5 Flash), HuggingFace (Inference API)
  • BYOK (Bring Your Own Key) β€” Users can securely store their own provider API keys, encrypted at rest with AES-256-GCM. BYOK keys bypass the platform quota gate entirely and are decrypted ephemerally per request β€” never cached or exposed to browser clients
  • Model Configuration Dashboard β€” Per-app model configs with provider selection, parameter tuning (temperature, max tokens, top-p), and system prompts
  • A/B Testing β€” Model config versioning with traffic splitting and performance metrics tracking
  • Streaming Responses β€” Server-Sent Events (SSE) for real-time token-by-token output
  • Conversation Management β€” Create, continue, archive conversations per application
  • Prompt Templates β€” Reusable templates with {{variable}} substitution
  • Knowledge Base (RAG) β€” Vector-based semantic search with OpenAI embeddings, document chunking, and context retrieval

πŸ”Œ Plugin System

  • WordPress-Style Hooks β€” Actions and filters with priority-based execution
  • Plugin SDK β€” TypeScript interfaces and utilities for plugin development
  • Advanced Capabilities β€” Database access (scoped key-value store), custom API endpoints, cron scheduling, webhooks, admin UI extensions, inter-plugin event bus
  • Lifecycle Management β€” Install, activate, deactivate, uninstall with dependency resolution
  • Marketplace β€” Browse, search, rate, and review plugins and themes with 8 categories
  • Plugin Versioning β€” Multiple versions per plugin with changelogs, compatibility checks, and checksums
  • Developer Portal β€” Submit plugins/themes for marketplace review, admin approval workflow
  • Download Tracking β€” Automatic install/download counters
  • Per-App Installation β€” Install and configure plugins independently per application

🎨 Themes & Customization

  • Theme Engine β€” CSS custom property generation with 4 built-in presets
  • White-Label Branding β€” Custom colors, fonts, logos, email templates, and CSS injection
  • Custom Domains β€” DNS verification (CNAME/TXT), SSL tracking, domain settings
  • Embeddable Widget β€” Standalone JavaScript widget for any website with theme support

πŸ‘₯ Teams & Collaboration

  • Organizations β€” Team creation with member management (Owner/Admin/Member/Viewer roles)
  • SSO Integration β€” SAML 2.0 and OIDC support with auto-provisioning
  • Notifications β€” In-app notification system with real-time updates
  • Audit Logging β€” Comprehensive audit trail for all platform actions

πŸ’³ Billing & Subscriptions

  • Stripe Integration β€” 4 subscription tiers (Free, Starter $29/mo, Pro $99/mo, Enterprise $499/mo)
  • Usage Metering β€” Token and message quotas with enforcement before AI calls; paid plans report overage tokens to Stripe as metered usage records for automatic per-1K-token billing
  • Webhooks β€” 11 event types with HMAC-SHA256 signing and delivery tracking
  • Data Export/Import β€” JSON and CSV export, bulk import with error handling

πŸ” Authentication & Security

  • OAuth2 β€” GitHub and Google OAuth with automatic account linking
  • JWT + Refresh Tokens β€” Secure authentication with token rotation
  • API Keys β€” Create, scope, rate-limit, and revoke API keys per application
  • Provider Key Vault β€” User BYOK provider keys stored encrypted with AES-256-GCM; only a 4-character hint is ever returned by the API
  • Role-Based Access Control β€” Admin, Developer, User roles with permission guards
  • Security Hardening β€” Helmet middleware, CORS, rate limiting, HSTS, CSP headers

πŸ“Š Analytics & Monitoring

  • Usage Analytics β€” Track conversations, messages, tokens, costs per application
  • Event Tracking β€” MongoDB-backed event stream (message_sent, widget_loaded, api_call, error)
  • System Health β€” Real-time service checks (PostgreSQL, MongoDB, Redis, AI Service)
  • Platform Statistics β€” Users, applications, subscriptions, resource usage

πŸš€ Deployment & Self-Hosting

  • Self-Hosted Installer CLI β€” Interactive installation wizard (agentbase install) with system requirements checking, database setup, admin account creation, and .env generation
  • Update Mechanism β€” agentbase update with automatic backups, migration running, and dependency updates
  • System Status β€” agentbase status shows version, service health, and Docker container status
  • Docker Production Stack β€” Multi-stage builds with Alpine images, health checks, non-root user
  • Nginx Reverse Proxy β€” SSL termination, rate limiting, security headers, SSE streaming
  • Email Service β€” SMTP transport with HTML templates (welcome, password reset, usage warnings)
  • File Uploads β€” S3-compatible storage (AWS S3, MinIO, DigitalOcean Spaces, Cloudflare R2)
  • Automated Backups β€” PostgreSQL and MongoDB backup scripts with 7-day retention

πŸ“– Documentation

  • Self-Hosting Guide β€” Complete installation and configuration instructions
  • Plugin Development β€” Getting started, SDK reference, advanced capabilities, publishing guide
  • AI Models Guide β€” Provider configuration, model settings, A/B testing
  • API Reference β€” Full marketplace, model configs, and provider keys API documentation
  • Examples Gallery β€” AI chatbot, plugin with database, custom theme, embeddable widget, RAG pipeline

API Endpoints

Authentication

  • POST /api/auth/register β€” Register new user
  • POST /api/auth/login β€” Login
  • GET /api/auth/me β€” Get current user
  • GET /api/auth/github β€” OAuth: Redirect to GitHub
  • GET /api/auth/github/callback β€” OAuth: GitHub callback
  • GET /api/auth/google β€” OAuth: Redirect to Google
  • GET /api/auth/google/callback β€” OAuth: Google callback
  • GET /api/auth/providers β€” List available OAuth providers
  • POST /api/auth/change-password β€” Change password
  • POST /api/auth/password-reset/request β€” Request password reset

Applications

  • POST /api/applications β€” Create application
  • GET /api/applications β€” List user's applications
  • GET /api/applications/:id β€” Get application
  • PUT /api/applications/:id β€” Update application
  • DELETE /api/applications/:id β€” Delete application

Plugins

  • GET /api/plugins β€” List marketplace plugins
  • POST /api/plugins β€” Create plugin
  • PUT /api/plugins/:id/publish β€” Publish plugin
  • POST /api/applications/:appId/plugins β€” Install plugin
  • PUT /api/applications/:appId/plugins/:id/activate β€” Activate plugin
  • PUT /api/applications/:appId/plugins/:id/deactivate β€” Deactivate plugin
  • DELETE /api/applications/:appId/plugins/:id β€” Uninstall plugin
  • ALL /api/plugins/:pluginId/endpoints/* β€” Dynamic plugin custom endpoints

Marketplace

  • GET /api/marketplace/plugins/browse β€” Browse plugins
  • GET /api/marketplace/plugins/featured β€” Featured plugins
  • GET /api/marketplace/plugins/categories β€” Plugin categories
  • GET /api/marketplace/plugins/:id β€” Plugin detail with rating stats
  • GET /api/marketplace/plugins/:id/reviews β€” Plugin reviews
  • POST /api/marketplace/plugins/:id/reviews β€” Submit review
  • GET /api/marketplace/plugins/:id/versions β€” Plugin versions
  • POST /api/marketplace/plugins/:id/versions β€” Publish new version
  • GET /api/marketplace/themes/browse β€” Browse themes
  • GET /api/marketplace/themes/featured β€” Featured themes
  • GET /api/marketplace/themes/:id β€” Theme detail
  • GET /api/marketplace/themes/:id/reviews β€” Theme reviews
  • POST /api/marketplace/themes/:id/reviews β€” Submit theme review
  • POST /api/marketplace/submit/plugin β€” Developer: submit plugin
  • POST /api/marketplace/submit/theme β€” Developer: submit theme
  • GET /api/marketplace/admin/plugins/pending β€” Admin: pending plugins
  • POST /api/marketplace/admin/plugins/:id/approve β€” Admin: approve plugin
  • POST /api/marketplace/admin/plugins/:id/reject β€” Admin: reject plugin
  • GET /api/marketplace/admin/themes/pending β€” Admin: pending themes
  • POST /api/marketplace/admin/themes/:id/approve β€” Admin: approve theme
  • POST /api/marketplace/admin/themes/:id/reject β€” Admin: reject theme

Provider Keys (BYOK)

  • GET /api/provider-keys β€” List saved provider keys (key hints only)
  • PUT /api/provider-keys/:provider β€” Save or replace a key (openai | anthropic | gemini | huggingface)
  • DELETE /api/provider-keys/:provider β€” Remove a saved key
  • POST /api/provider-keys/:provider/validate β€” Validate a saved key with a live test call

Model Configs

  • GET /api/model-configs?applicationId= β€” List model configs
  • POST /api/model-configs β€” Create model config
  • GET /api/model-configs/:id β€” Get model config
  • PUT /api/model-configs/:id β€” Update model config
  • DELETE /api/model-configs/:id β€” Delete model config
  • PATCH /api/model-configs/:id/default β€” Set default model
  • GET /api/model-configs/:id/versions β€” List A/B test versions
  • POST /api/model-configs/:id/versions β€” Create A/B test version

Prompt Templates

  • POST /api/prompts β€” Create prompt template
  • GET /api/prompts?applicationId= β€” List templates for app
  • GET /api/prompts/:id β€” Get prompt template
  • PUT /api/prompts/:id β€” Update prompt template
  • DELETE /api/prompts/:id β€” Delete prompt template
  • PUT /api/prompts/:id/default β€” Set as default template
  • POST /api/prompts/render β€” Render template with variables

Themes

  • GET /api/themes β€” List themes
  • POST /api/themes β€” Create theme
  • PUT /api/applications/:id/theme β€” Set application theme
  • PUT /api/applications/:id/theme/customize β€” Customize theme

AI Service

  • GET /api/ai/providers β€” List AI providers
  • POST /api/ai/conversations β€” Create conversation
  • POST /api/ai/conversations/:id/messages β€” Send message (standard)
  • POST /api/ai/conversations/:id/stream β€” Send message (SSE streaming)
  • GET /api/ai/conversations/by-app/:appId β€” List conversations
  • DELETE /api/ai/conversations/:id β€” Archive conversation

AI Providers

Agentbase supports multiple AI providers out of the box:

  • OpenAI β€” GPT-4, GPT-4o, GPT-3.5 Turbo
  • Anthropic β€” Claude Sonnet 4.5, Claude Haiku 4.5
  • Google Gemini β€” Gemini 2.0 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash
  • HuggingFace β€” Any model via the Inference API (Mistral, Llama, Falcon, etc.)

Configure provider keys in one of two ways:

  • Platform keys (paid plans) β€” set OPENAI_API_KEY, ANTHROPIC_API_KEY, etc. in .env. Usage is metered and included in your plan quota; overages are billed automatically via Stripe.
  • BYOK (all plans including Free) β€” users can save their own provider API keys in Dashboard β†’ Settings β†’ AI Providers. Keys are AES-256-GCM encrypted at rest and bypass the monthly quota gate entirely.

Agentbase handles provider routing, rate limiting, and conversation management automatically.

Required for BYOK: set ENCRYPTION_KEY to a 64-hex-char secret (generate with node -e "console.log(require('crypto').randomBytes(32).toString('hex'))").

Changelog

See CHANGELOG.md for a detailed history of changes across all phases.

Contributing

See CONTRIBUTING.md for development guidelines.

License

GNU General Public License v3.0 β€” see LICENSE

Built by AgentaFlow

About

The open-source app platform for AI

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors