Labsco
butterbase-ai logo

Butterbase

β˜… 2,100

from butterbase-ai

Full-stack backend platform MCP β€” provision apps, manage databases, deploy functions, and more.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

AI-native, open-source backend-as-a-service. Postgres Β· Auth Β· Storage Β· Functions Β· AI Gateway Β· MCP server

Website Β· Discord Β· LinkedIn Β· Self-host Β· Docs Β· Roadmap Β· Examples Β· Contributing

Butterbase gives you the building blocks for AI-driven applications without lock-in: a Postgres-backed backend with row-level security, serverless functions, an LLM gateway, realtime subscriptions, key-value store, file storage, RAG, durable per-key actors, and a built-in Model Context Protocol (MCP) server so agents can operate your backend with tools instead of glue code.

Features

Data

  • Postgres data plane β€” per-app databases with declarative schema (/schema), automatic REST endpoints (/auto-api), and migrations.

  • Row-Level Security β€” first-class RLS policy management with user-isolation helpers (/rls).

  • Key-Value store β€” regional, quota-protected KV with TTL, audit trail, and dashboard expose rules (/v1/:app/kv/*). New in v0.2.0.

  • File storage β€” S3/R2-backed object storage with presigned URLs, ACLs, and async indexing (/storage).

Compute

  • Serverless functions β€” TypeScript functions executed on the Deno runtime (/functions).

  • Durable Objects β€” stateful per-key actors for chat rooms, multiplayer, rate limiters, long-running agents (/durable-objects).

  • Realtime β€” WebSocket subscriptions to table changes for live UIs and presence (/realtime).

  • Edge SSR β€” deploy Next.js / Remix / Astro edge handlers from source (/edge-ssr, /edge-ssr-from-source).

  • Frontend hosting β€” zip or build-from-source static / SPA deploys with custom domains (/frontend, /custom-domains).

AI

  • AI gateway β€” single endpoint for chat, embeddings, model listing; pluggable router adapters (/gateway, /ai-config).

  • RAG β€” managed collections, document ingestion, semantic search and synthesized answers (/rag).

  • Integrations β€” third-party tool access via Composio (/integrations).

Identity & ops

  • Auth β€” email + OAuth (Google, GitHub, Apple, X, …), JWT tuning, post-login hooks, service keys (/auth, /oauth-config, /api-keys).

  • Audit logs β€” structured request audit trail across KV and other surfaces (/audit-logs).

  • Webhooks β€” outbound webhooks for app events (/webhooks).

  • Multi-region app moves β€” relocate an app across regions with retained source replicas (scripts/move-app/).

Agent surface

  • MCP server β€” every capability above is exposed as MCP tools at /mcp (HTTP) or via stdio (@butterbase/mcp β€” npx @butterbase/mcp).

  • Claude Code plugin β€” packages/plugin (submodule of butterbase-skills) ships 30+ guided skills (idea β†’ plan β†’ schema β†’ auth β†’ functions β†’ deploy β†’ submit) for agentic app building.

Open-source vs. managed

This repo ships the runtime data plane β€” everything required to self-host a fully featured Butterbase instance. The managed offering at butterbase.ai adds multi-region orchestration, billing, upstream AI router adapters, lease-based quota enforcement, and ops dashboards (those live in a private repo that consumes this one as a submodule).

When you self-host, the AI gateway runs without upstream router adapters, billing uses a no-op provider, and quotas are unlimited. Wire your own implementations via the BillingProvider, QuotaEnforcer, and RouterAdapter interfaces in packages/shared.

Architecture

Copy & paste β€” that's it
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ Your app Β· agent Β· MCP client Β· CLI β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 β”‚ REST Β· WebSocket Β· MCP
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ control-api (Fastify) β”‚
 β”‚ apps Β· auth Β· schema Β· auto-api Β· RLS β”‚
 β”‚ storage Β· functions Β· KV Β· realtime β”‚
 β”‚ AI gateway Β· RAG Β· DOs Β· MCP at /mcp β”‚
 β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
 β”‚ β”‚ β”‚ β”‚ β”‚
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β–Όβ”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ Postgres β”‚ β”‚ S3 / β”‚ β”‚Redisβ”‚ β”‚ Deno β”‚ β”‚ Python agent β”‚
 β”‚ 3 planes β”‚ β”‚ R2 β”‚ β”‚ KV β”‚ β”‚runtime β”‚ β”‚ runtime β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ Cloudflare: β”‚
 β”‚ build-runner Β· β”‚
 β”‚ dispatch-worker β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Three Postgres planes:

  • control-plane (db/control-plane/) β€” platform metadata: users, apps, billing, audit.

  • runtime-plane (db/runtime-plane/) β€” hot-path runtime tables (KV expose rules, realtime channels, sessions).

  • data-plane (db/data-plane/) β€” per-app user data; each app gets isolated schemas with RLS.

Repo layout

Services (services/)

Service Language What it does control-api Node.js / Fastify Main entry point. All public APIs, embeds MCP at /mcp. mcp-server Node.js MCP tool implementations (built into control-api; also ships as butterbase-mcp stdio binary). deno-runtime Deno Executes user serverless functions in isolates. agent-runtime Python (uv) Long-running agent executor for manage_ai / agent tasks. build-runner Cloudflare Worker Builds frontends and edge-SSR bundles from source. storage-indexer Node.js Async indexer for uploaded objects. docs Astro Public documentation site (also served locally at :4321).

Packages (packages/)

Package Description @butterbase/sdk Universal TypeScript SDK (browser + server). @butterbase/cli butterbase CLI for scaffolding and backend management. @butterbase/plugin Claude Code plugin β€” 30+ guided skills for AI-driven app building. Git submodule of butterbase-skills. @butterbase/shared Shared types, constants, and pluggable interfaces (BillingProvider, QuotaEnforcer, RouterAdapter).

Other top-level pieces

  • dispatch-worker/ β€” Cloudflare Worker that routes per-app subdomain traffic.

  • bb-placeholder/ β€” placeholder origin for unprovisioned subdomains.

  • infra/ β€” pgbouncer and traefik configs for self-host.

  • db/ β€” SQL migrations for the three Postgres planes.

  • Examples/ β€” todo-2026-04-02, grocery-list-2026-04-03.

What's not in this repo

The OSS / managed boundary is intentional. The following are private to the managed offering:

  • Multi-region orchestration and the cross-region scheduler.

  • Billing logic, lease-based quota math, and Stripe wire-up beyond the no-op provider.

  • Upstream AI router adapters (OpenAI / Anthropic / Bedrock provider integrations beyond the gateway interface).

  • Customer / admin dashboards, hackathon-host dashboards, and ops tooling.

If you need these for self-host, implement against the interfaces in packages/shared β€” see CONTRIBUTING.md for the scope rules.

Documentation

Project status

Latest release: v0.2.0 (2026-05-25) β€” adds the KV store across SDK / REST / CLI / MCP. The data plane is production-tested by the managed offering; the OSS distribution is young β€” please file self-host issues and we'll tighten docs and defaults from feedback. See CHANGELOG.md for the full history.

Community & support

Contributing

See CONTRIBUTING.md. The boundary between OSS and the managed offering is intentional β€” please read the scope section before opening a PR that touches billing, quota math, or upstream router adapters.

Security

See SECURITY.md. Report vulnerabilities to [emailΒ protected].

License

Apache-2.0. Copyright 2026 NetGPT Inc.

Contributors

Star history