@hacr/opencode-autobe
v0.1.0
Published
OpenCode plugin for AutoBE — AI-powered NestJS + Prisma backend generation
Maintainers
Readme
opencode-autobe
An OpenCode plugin that integrates AutoBE — the AI-powered NestJS + Prisma backend generator — directly into your OpenCode sessions.
What it does
Adds three tools to OpenCode:
| Tool | Description |
|------|-------------|
| autobe_generate | Generate a complete NestJS + Prisma backend from a natural-language description |
| autobe_list_sessions | List recent AutoBE sessions on your playground server |
| autobe_get_files | Retrieve generated files from a completed session and write them to your project |
Prerequisites
- AutoBE playground server — clone autobe and run the playground server
- AI API key — Anthropic, OpenAI, or any OpenAI-compatible provider
Installation
As an npm plugin (recommended)
Add to your opencode.json:
{
"plugins": ["@hacr/opencode-autobe"]
}Local development
Clone this repo and place the project in your working directory. OpenCode will auto-load .opencode/plugins/autobe.ts.
Configuration
Set these environment variables before starting OpenCode:
| Variable | Default | Description |
|----------|---------|-------------|
| AUTOBE_SERVER_URL | http://localhost:3000 | AutoBE playground server URL |
| AUTOBE_API_KEY | — | API key for the AI vendor (overrides other keys) |
| ANTHROPIC_API_KEY | — | Anthropic API key (used if AUTOBE_API_KEY not set) |
| OPENAI_API_KEY | — | OpenAI API key (used as last fallback) |
| AUTOBE_BASE_URL | — | Custom base URL for OpenAI-compatible endpoints |
| AUTOBE_MODEL | claude-sonnet-4-20250514 | Default AI model |
| AUTOBE_VENDOR_ID | — | Skip vendor creation, use this existing vendor ID |
Usage
Once configured, just describe your backend in natural language:
Generate a backend for a blog platform with posts, comments, tags, and user authOpenCode will call autobe_generate and run the full AutoBE pipeline:
- Requirements analysis — structures your description into a formal spec
- Database design — creates a type-safe Prisma schema
- API design — generates an OpenAPI specification
- Test generation — writes E2E test suites
- Code generation — produces compilable NestJS implementation
All generated files are written to your current project directory.
AutoBE pipeline
AutoBE uses a waterfall + spiral architecture with compiler-driven validation:
Requirements → Prisma Schema → OpenAPI Spec → E2E Tests → NestJS Implementation
↑ ↑ ↑ ↑ ↑
Analyze Database Interface Test RealizeEach phase validates against its compiler (Prisma → OpenAPI → TypeScript) before proceeding.
Starting the playground server
# Clone autobe
git clone https://github.com/samchon/autobe
cd autobe
# Install dependencies
pnpm install
# Set up database
cd apps/playground-server
npx prisma db push
# Start the server (default port from .env.local)
pnpm exec ts-node src/executable/server.tsSet AUTOBE_SERVER_URL to the server's address and port.
License
MIT
