KevinLiss/ApeAdmin

Apeadmin 面向现代AI应用打造的Python后台管理框架,基于 FastAPI+Vue3 设计100%开源,内置 RBAC 权限管控、审计日志等企业级基础能力。框架集成 MCP‑SSE 网关,具备强大插件生态完整,帮助开发者快速搭建兼具业务管理与 AI 工具输出能力的应用。

ApeAdmin – Open‑source admin platform built for modern AI applications

What it is – ApeAdmin is a full‑stack, plug‑in‑enabled admin framework designed to host AI‑driven services. It combines a FastAPI back‑end with a Vue 3 front‑end and adds a MCP‑SSE gateway that exposes management functions (RBAC, plugins, logs, etc.) as tools that AI agents can call via function‑calling. In short, it gives you a ready‑made “backend‑as‑a‑service” that can be extended with independent Python plugins and accessed both by human operators and by LLM agents.


Core capabilities

Category What you get
Installation wizard WordPress‑style three‑step setup (DB config → site & admin → finish). Auto‑creates MySQL databases, generates JWT secrets, and writes a lock file to prevent re‑runs.
RBAC Five‑table model (users, roles, menus, departments, association). Four‑layer permission checks (no‑login → no‑auth → rule → data scope) and front‑end v‑permission directive for button‑level hiding.
Plugin system Python‑package plugins discovered via importlib. Supports hot‑load/unload, Docker‑isolated deployment, ZIP upload, and an online plugin marketplace. Plugins can register routes, MCP tools, and event listeners.
MCP‑SSE gateway Translates internal management APIs into Tools / Resources / Prompts that LLM agents can invoke. JSON‑Schema is auto‑derived from function signatures, RBAC‑filtered, and secured with one‑time tickets and 30 s timeout. All calls are audited.
AI chat assistant Multi‑model support (OpenAI, DeepSeek, Alibaba Tongyi, Zhipu GLM, or any OpenAI‑compatible endpoint). Streaming SSE output, markdown rendering, and up to five rounds of tool‑calling loops. Model keys are stored encrypted with Fernet.
Audit & monitoring Request‑ID middleware, operation logs, per‑API latency tracking, and searchable audit logs.
Database flexibility SQLite for quick local dev, MySQL for production; automatic driver switch via DB_TYPE. Optional Redis cache with graceful fallback to in‑memory store.

Architecture at a glance

apeadmin/
  backend/          # FastAPI (async SQLAlchemy, Alembic migrations)
    src/
      api/          # REST endpoints (auth, users, roles, plugins, AI chat…)
      core/         # config, security (JWT + bcrypt), middleware, seeds
      crud/         # generic CRUD with RBAC hooks
      db/           # engine & session handling
      models/       # ORM definitions (rbac, plugins, AI, MCP logs)
      mcp/          # MCP manager, routes, built‑in tools
      plugins/      # plugin interface, manager, builtin examples
      ai/           # agent orchestration, function‑calling loop
      schemas/      # Pydantic request/response models
      main.py       # app entry point (lifespan, setup mode)
  frontend/         # Vue 3 + Vite + TypeScript + Element Plus UI
    src/
      api/          # Axios wrappers for all back‑end routes
      components/   # header, sidebar, etc.
      directives/   # `v-permission`
      router/       # dynamic routes generated from back‑end menu tree
      stores/       # Pinia stores for user, menu, permissions
      views/        # pages (login, system admin, plugin market, AI chat…)

The design principle is “install‑and‑run” – an un‑configured instance redirects to /setup, writes a .env file, creates tables, and then behaves as a normal multi‑tenant admin system.


Who might use it?

Scenario Why ApeAdmin helps
AI SaaS platform Expose internal tools (data retrieval, user management, custom business logic) to LLM agents without writing separate APIs.
Enterprise internal tools Quickly spin up a permission‑aware admin UI for managing users, departments, and custom plugins while keeping a single source of truth.
Plugin ecosystem Teams can develop independent Python plugins (e.g., data connectors, model wrappers) that are discovered and hot‑loaded, keeping the core stable.
Rapid prototyping Use the SQLite dev mode and the three‑step wizard to get a functional admin panel running in minutes.

Getting started (quick‑start)

  1. Back‑end
    cd backend
    python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
    pip install -e .
    uvicorn src.main:app --reload --host 0.0.0.0 --port 8000
    
  2. Front‑end
    cd frontend
    npm install --legacy-peer-deps
    npm run dev   # serves at http://localhost:5173
    
  3. Open the URL; the app will detect the missing configuration and launch the setup wizard where you can pick SQLite (zero‑config) or point it at a MySQL instance.
  4. After installation, log in with the admin credentials you defined, then explore:
    • System → Users / Roles / Menus / Departments
    • Plugins → Marketplace, upload ZIP, enable/disable
    • MCP → Tools / Resources / Prompt templates
    • AI → Add model API keys and start a chat session that can call your registered tools.

For production you can follow the Docker/Nginx scripts in deploy/DEPLOY.md.


Technology stack

Layer Tech
Back‑end FastAPI, async SQLAlchemy 2.0, Alembic, Pydantic‑Settings, JWT, bcrypt
Front‑end Vue 3.5, Vite 6, TypeScript 5.7, Element Plus 2.9, Pinia, ECharts
Database MySQL (via aiomysql) or SQLite (aiosqlite)
Cache Redis (optional)
AI integration MCP (Model Context Protocol) over Server‑Sent Events, supports OpenAI‑compatible endpoints
Packaging MIT license, pip‑editable install for the back‑end, npm for the front‑end

License & community

  • License: MIT – free for commercial and non‑commercial use.
  • Community: Official website, plugin marketplace, documentation portal, and a WeChat user group (QR code in the repo). Contributions follow a standard fork‑branch‑PR workflow with clear branch‑naming conventions.

TL;DR

ApeAdmin is a plug‑in‑first, AI‑aware admin framework that lets you manage users, permissions, and custom business logic while automatically exposing those capabilities as callable tools for LLM agents. It ships with a ready UI, an installation wizard, and a full plugin ecosystem, making it a solid foundation for any modern AI‑centric product.

Related

  • Project
  • Project
  • Project
  • Project
  • Project