Skip to content

About

Conversational AI app builder: describe it, watch it build, own every line. Self-hostable, AGPL-3.0.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Codebase

Describe it. We build it.

Conversational AI that turns plain English into a running Next.js application — streamed live, previewed instantly, shipped from one workspace.

Next.js React TypeScript Node.js Convex License

Website · API Reference · Quickstart · Status


Table of contents

Overview

Codebase is a conversational application builder. You describe what you want in plain English — or say it out loud — and a streaming agent writes a working Next.js app in real time. You watch every tool call as it happens, preview the result in an embedded frame, and keep iterating in the same conversation.

The core loop:

  1. Describe your app, by text or voice.
  2. Refine — the agent asks clarifying questions and proposes a build plan.
  3. Watch it build live: timeline, narration, file-by-file changes.
  4. Preview the running result, then request follow-up changes conversationally.

Features

Building

  • Native agent loop — streams tool calls (create, edit, delete, shell) over WebSocket as they execute
  • Plan review — see and approve the build plan before any code is written
  • Adaptive Q&A — the agent asks clarifying questions instead of guessing
  • Live preview — embedded frame that refreshes when a build completes
  • Follow-up changes — conversational continuity with reactive context compaction
  • Extended sessions — 100+ turns with checkpoint and resume, so long builds survive a disconnect
  • Validator gate — a build only reports success when the preview actually compiles, and only successful turns are billed
  • Sandboxed builds — Docker workers with CPU and memory limits, controlled network egress, and no access to host secrets
  • Any stack — vanilla HTML/CSS/JS, React, Vue, Svelte, Next.js, TypeScript

Models

  • 13 model vendors — MiniMax, Z.AI (GLM), Qwen, Anthropic, DeepSeek, Kimi, Fireworks, Cerebras, Groq, OpenAI, Xiaomi (MiMo), Google (Gemini), and Codebase itself
  • First-party inference — two self-hosted pools (DeepSeek V4 Flash and Qwen 27B FP8) form the cheapest tier in the catalogue, and d4f / "Codebase Auto" is the default model
  • Multi-role Glue layer — distinct fast, smart, genius, planning, and secondary models, so classification, narration, and planning each run on the cheapest model that can do the job
  • Fallback chains — automatic provider failover with partial-stream recovery mid-generation
  • Image generation — builds render real images instead of placeholder boxes
  • Web search — the agent can pull live docs and references via Tavily
  • Voice I/O — dictation plus a modular TTS layer with browser and Kokoro engines

Shipping what you built

  • One-click deploy — Vercel and Netlify, free subdomain, persisted deploy history
  • Custom domains — CNAME verification with automatic TLS
  • Pre-publish checklist — SEO, performance, accessibility, and security scoring before a project goes public
  • SAST scanner — per-file security findings surfaced during the build, blocking publish on critical issues
  • Export — download any project as a ZIP

Platform

  • Project gallery — browse, fork, and remix community projects
  • Prompts library — shared, forkable prompt templates
  • Credits and billing — Stripe checkout with a pre-build cost estimator, plus crypto top-ups against the same ledger
  • Referral program — code attribution, funnel tracking, and a payout dashboard
  • Public REST API — OpenAPI 3.1, versioned /api/v1/, scoped API keys, with generated TypeScript, Swift, and Kotlin clients
  • Admin operator plane — build success rates, credit ledger, and crypto configuration
  • 15 locales with RTL — full next-intl setup; Arabic ships right-to-left end to end
  • Native packaging — Tauri shell with a tag-triggered release build and a /downloads page

Access and safety

  • OAuth — Google and GitHub via NextAuth v5, JWT sessions
  • Wallet auth — RainbowKit + wagmi sign-in
  • API keys and OAuth 2.0 — bearer keys plus auth-code + PKCE, refresh, and device-code grants
  • Rate limiting — per-user quotas by plan tier
  • Secrets at rest — workspace environment variables encrypted through a credential vault

Architecture

flowchart LR
    U([Browser])

    subgraph app["Application"]
        FE["Next.js 15<br/>App Router"]
        BE["Express + tRPC + ws"]
    end

    subgraph agent["Agent runtime"]
        AG["Agent loop<br/>tools · streaming"]
        GL["Glue LLM<br/>fast intent routing"]
        SB["Docker build workers<br/>network-isolated"]
    end

    subgraph data["State"]
        CV[("Convex<br/>reactive DB")]
        RQ[("Redis + BullMQ<br/>job queue")]
        S3[("S3-compatible<br/>artifacts")]
    end

    U -->|HTTPS| FE
    U -->|WebSocket| BE
    FE --> BE
    BE --> GL
    BE --> AG
    AG --> LLM[["Provider registry"]]
    AG --> SB
    BE --> CV
    BE --> RQ
    SB --> S3
Loading

Repository map

codebase/
├── web/                       # Primary application
│   ├── app/                   # Next.js 15 App Router
│   │   ├── workspace/         #   Builder UI — chat, preview, timeline
│   │   ├── admin/             #   Operator plane
│   │   ├── gallery/           #   Community gallery
│   │   ├── api-docs/          #   Scalar API reference
│   │   └── pricing/           #   Credit plans and tiers
│   ├── backend/               # Express + tRPC + WebSocket
│   │   ├── agent/             #   Agent loop, tool handlers, streaming
│   │   ├── glue/              #   Fast-LLM intent classification
│   │   ├── providers/         #   Multi-LLM provider registry
│   │   ├── ws/                #   WebSocket message routing
│   │   ├── routes/            #   REST endpoints
│   │   ├── services/          #   Credits, projects, business logic
│   │   └── docker/            #   Sandboxed build images and egress control
│   ├── components/            # Shared React components
│   ├── convex/                # Convex schema, queries, mutations
│   ├── scaffolding/           # Project scaffolds and templates
│   ├── i18n/                  # 15 locales, RTL pipeline
│   ├── mcp-server/            # Model Context Protocol server
│   └── ecosystem.config.cjs   # PM2 process definitions
│
├── clients/                   # Generated API SDKs — TypeScript, Swift, Kotlin
├── skills/                    # Platform skill packages
├── contracts/                 # Onchain contracts
├── tauri/                     # Native desktop and mobile shell
├── extensions/                # Editor and browser extensions
├── docker/                    # Compose stacks and images
├── docs/                      # Setup, benchmarks, product docs
└── convex-backend/            # Submodule — self-hosted Convex (OSS)

Services and ports

Service Development Production Process
Next.js frontend 3333 3002 PM2 → next start
Express + WebSocket API 3001 3001 PM2 → node server.js
Convex 3232 (public 3242) managed self-hosted container

Production processes are defined in web/ecosystem.config.cjs. Put any reverse proxy with TLS and WebSocket support in front. Every port is overridable — see Configuration.

Quick start

Prerequisites: Node.js 22+, npm 10+, Git 2.13+. No database or Redis required for local development.

# 1. Clone with submodules
git clone --recurse-submodules https://github.com/codebase/codebase-oss.git
cd codebase-oss/web

# 2. Configure — set at least one LLM API key
cp .env.example .env.local

# 3. Install
npm install
npm --prefix backend install

# 4. Run the full stack
npm run dev:all
Frontend http://localhost:3333
Backend http://localhost:3001

Important

Use npm run dev:all, not npm run dev. The plain dev script starts only Next.js, which leaves /api/*, tRPC routes, and the /workspace builder flow unavailable. The workspace also needs NEXT_PUBLIC_CONVEX_URL — the default self-hosted value is already in web/.env.example.

Tip

QUICKSTART.md covers the full setup path: environment variables, custom ports, authentication providers, Convex, production deployment, and troubleshooting.

Configuration

All configuration lives in web/.env.local. Start from web/.env.example, but treat web/backend/providers/registry.js as authoritative for model configuration — each provider entry declares its own apiKeyEnv, and the example file does not yet list them all.

# Model selection — resolves to `d4f` (Codebase Auto) when unset or unknown
DEFAULT_MODEL=d4f

# Providers — set at least one; see `registry.js` for the full set
MINIMAX_API_KEY=
ZHIPU_API_KEY=
QWEN_API_KEY=
ANTHROPIC_API_KEY=
FIREWORKS_API_KEY=
CEREBRAS_API_KEY=

# Glue layer — one key, five model roles
GLUE_API_KEY=
GLUE_FAST_MODEL=gpt-oss-120b
GLUE_SMART_MODEL=gpt-oss-120b
GLUE_GENIUS_MODEL=zai-glm-4.7
GLUE_SECONDARY_MODEL=kimi-k2.7-code
GLUE_PLAN_MODEL=                 # falls back to GLUE_SMART_MODEL

# Agent tools
TAVILY_API_KEY=

# Auth
AUTH_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

# Backend connectivity
NEXT_PUBLIC_BACKEND_HOST=localhost
NEXT_PUBLIC_BACKEND_WS_PORT=3001
NEXT_PUBLIC_BACKEND_PROTOCOL=http
NEXT_PUBLIC_BACKEND_WS_PROTOCOL=ws

# Data
NEXT_PUBLIC_CONVEX_URL=http://127.0.0.1:3232

# Ports (optional overrides)
FRONTEND_PORT=3333
BACKEND_PORT=3001

Development

Run from web/.

Command What it does
npm run dev:all Full stack — frontend, backend, and dependencies
npm run dev Next.js only
npm run build Production build
npm run lint ESLint, including custom repo rules
npm run typecheck tsc --noEmit
npm run test Frontend unit tests (Vitest)
npm run test:backend Backend unit tests
npm run test:convex Convex function tests and admin-surface check
npm run test:all Every suite — frontend, Convex, backend, MCP, lint rules
npm run cypress:run End-to-end suite
npm run test:mobile Mobile sweep and flow checks

Commits run lint-staged through Husky. CI (.github/workflows/ci.yml) gates master, dev, and kaspa-dev on lint, type check, unit tests, production build, E2E, and a security audit.

Deployment

The hosted instance at codebase.design runs Next.js and the Express API under PM2 behind a reverse proxy, with self-hosted Convex, Redis, and Docker build workers.

To run your own:

cd web
npm ci && npm --prefix backend ci
npm --prefix backend run build:trpc
npx convex deploy            # against your Convex deployment
npm run build
pm2 start ecosystem.config.cjs

The build:production and start:production scripts read web/.env.production through dotenvx. That file is not in this repository — create your own from web/.env.example. The operator's deploy tooling, host inventory, and runbooks are specific to one datacenter and are not included.

API and SDKs

The public REST API is specified in OpenAPI 3.1, served at /api-docs/json and browsable at /api-docs. The spec has one source of truth, so the reference and the clients cannot drift apart.

node clients/generate.mjs              # spec + all targets
node clients/generate.mjs typescript   # one target
Target Generator Output
TypeScript @hey-api/openapi-ts clients/typescript/
Swift openapi-generator (swift5) clients/swift/
Kotlin openapi-generator (kotlin) clients/kotlin/

Generated client code is not committed — regenerate it after API changes. Authenticate with an API key (Authorization: Bearer cb_..., created at /settings/api-keys) or an OAuth 2.0 bearer token. See clients/README.md and web/AGENT-API.md.

Documentation

Area Location
Setup and troubleshooting QUICKSTART.md
Environment setup docs/SETUP.md
Model and harness benchmarks docs/benchmarks/
Programmatic build API web/AGENT-API.md
Per-directory working notes AGENTS.md in each subtree

Status

This is the full source of the builder that runs at codebase.design, released as-is after a year of development. It is complete and in production, but it is not under active feature development.

What works today

Success-gated turn billing · build validator QA gate · Docker build sandboxing · one-click deploy · Stripe billing rails · x402 pay-per-build for agents · 100+ turn sessions with checkpoint/resume · provider fallback chains · WebSocket reconnect and build resume · SAST scanner with publish gate · workspace secret encryption · per-user rate limiting · versioned /api/v1/ with API keys · MCP server · prompts library · project export · 15-locale i18n with RTL

Internal planning documents, audits, and deploy tooling were removed for this release, so some code comments and AGENTS.md notes refer to paths under .settings/, deploy/, or docs/audits/ that are not here.

Contributing

Issues and pull requests are welcome; responses are best-effort.

  1. Read the local notes. Each subtree has an AGENTS.md describing its contracts. Read the ones on the path to the code you are changing.
  2. Keep commits small. One logical change per commit, with a body that explains why.
  3. Run the gates — npm run lint, npm run typecheck, and npm run test:all before pushing.

Security

Report suspected vulnerabilities to security@codebase.design. Scope and responsible-disclosure guidance are at codebase.design/security. Do not open public issues for security reports.

Never commit secrets. .env* files are gitignored, and CI runs a hardcoded-secret scan plus npm audit on every push.

License

GNU Affero General Public License v3.0.

You may run, modify, and redistribute this software. If you run a modified version as a network service, you must make your modified source available to its users under the same license.

About

Conversational AI app builder: describe it, watch it build, own every line. Self-hostable, AGPL-3.0.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages