About this project

OpenDoubao is an open-source AI Agent application generation platform, positioned as an open-source alternative to Doubao Work. Its core concept is: through natural language chat, impromptu generate highly available web frontend/backend applications, and no longer depend on large language models in subsequent interactions, thereby achieving safe, fast, and stable API calls. ## Core Architecture: Two-Stage Experience The project adopts a unique two-stage design: **Phase 1 - Generation Stage (Chat / AI or Rules)**: Users describe requirements through conversation, and the AI Agent generates the corresponding UI interface and proposes APIJSON requests. The request is executed after validation; on success, a bindRequest is issued to bind the template and parameter map (paramMap) to UI controls. **Phase 2 - Steady State (No LLM)**: When users subsequently modify filter conditions, sorting, pagination parameters, etc., BoundExecutor directly merges paramMap into bodyTemplate and calls the APIJSON endpoint via HTTP POST, consuming no tokens at all, with fast and stable response speed. ## Agent-to-API Protocol (A2API) The project defines the A2API 0.1 protocol, with an envelope format of { "version": "0.1", "type": { ... } }, where "type" is a placeholder for the message type, including the following message types: - **proposeRequest**: candidate APIJSON call - **reviseRequest / decision**: modify request or approve/reject - **bindRequest**: after code == 200, produces template and paramMap for UI-driven calls - **requestResult / status**: result and status feedback ## Security Mechanism The project has a built-in sensitive operation approval mechanism. Read operations are executed automatically, while write operations (by default including post, put, delete, gets, heads, overridable via the SENSITIVE_METHODS environment variable) require administrator approval in the Admin console before they can be invoked. The admin console provides three tabs: Apply (application form), Call logs, and Stats, supporting complex approval workflows for Access, Request, Document, and Chain. ## Tech Stack and Repository Structure - **Runtime**: Node.js 18+, Vite (frontend), Hono (API service) - **Data layer**: APIJSONBoot-MultiDataSource (or compatible service), running on localhost:8080 - **Repository modules**: - opendoubao: orchestrator + chat UI (generation) + bound filtering (steady state) - opendoubao-admin: configuration application approval; after approval, writes to Access / Request / Document - a2qpi/protocol: A2API 0.1 envelope, JSON Pointer, validators, CRUD fixture tests - a2qpi/runtime: ApiJsonClient, HitlController, BoundExecutor ## Quick Start Run: cd ~/a2api cp .env.example .env npm install npm test npm run build npm run dev After startup, the client runs at http://localhost:5173, the API service at http://localhost:3000, and the admin console is started via npm run dev:admin at http://localhost:5174. ## Configuration and Extension Users can log in/register via Login in the top-right corner, and configure AI Model, Base URL, and API Key. Quick query chips (such as "List the latest 3 moments with authors") are supported for fast queries. Optionally, set OPENAI_API_KEY in .env to enable LLM-assisted Bootstrap; when not configured, built-in intent rules can still recognize entities such as User / Moment / Comment (in both Chinese and English). The project provides rich demo data tables (User, Moment, Comment, as well as employees, activities, chats, news, info, blogs, articles, videos, music, products, orders, shipping addresses, categories, etc.); after importing, Access/Request must be reloaded. Write operations generally require a logged-in session (@role OWNER/LOGIN). In the MVP stage, requests are generated and a HITL approve/reject interface is displayed. ## Agent Automation Interface The project exposes the a2apiAgent automation interface, supporting JavaScript calls to methods such as switchTab and debug. You can specify a URL and JSON request body to send automatically, and also load an iframe and send requests automatically, making it easy to integrate into automated tests or workflows. ## Phase 2 Plans Cross-device synchronization (database table or file import/export) is planned in the design, but not yet implemented. ## Project Information The author is TommyLemon. The project is hosted on GitHub (open-doubao-ai/OpenDoubao). You are welcome to discuss technical issues via Issue and contribute code via Pull Request.