freshcrate
Skin:/
Home > MCP Servers > fastapi-agent-blueprint

fastapi-agent-blueprint

AI Agent Backend Platform on FastAPI — MCP server + AI orchestration + async DDD architecture. Zero-boilerplate CRUD, auto domain discovery, 14 Claude Code AI development skills.

Why this rank:Recent releaseStrong adoptionHealthy release cadence

Description

AI Agent Backend Platform on FastAPI — MCP server + AI orchestration + async DDD architecture. Zero-boilerplate CRUD, auto domain discovery, 14 Claude Code AI development skills.

README

No Docker, no PostgreSQL, no cloud credentials — SQLite + in-memory broker.

git clone https://github.com/Mr-DooSun/fastapi-agent-blueprint.git
cd fastapi-agent-blueprint
make setup        # one-time: venv + deps via uv
make quickstart   # FastAPI on :8001, SQLite schema auto-created

In a second terminal, make demo exercises the user domain and make demo-rag exercises the docs domain (end-to-end RAG: upload → chunk → embed → retrieve → answer with citations, zero credentials):

→ Health check
{ "status": "ok" }

→ Create a user
{ "success": true, "data": { "id": 1, "username": "alice",
                             "fullName": "Alice Liddell", ... } }

→ List users (page=1, pageSize=10)
{ "data": [ { "id": 1, "username": "alice", ... } ],
  "pagination": { "currentPage": 1, "totalItems": 1,
                  "hasNext": false, ... } }

→ Update the user    → Delete the user
→ Done. Swagger UI: http://127.0.0.1:8001/docs-swagger

Why this blueprint

  • Write domain logic once, expose it everywhere. HTTP (FastAPI) + worker (Taskiq) + admin (NiceGUI) share a single domain layer. MCP server is on the roadmap.
  • Zero-boilerplate CRUD. Inherit BaseRepository[DTO] and BaseService[Create, Update, DTO] to get 7 async methods — including paginated list with QueryFilter — for free.
  • Auto domain discovery. Drop a folder into src/{name}/, it auto-registers. No container edits, no bootstrap edits.
  • Pluggable infra, env-switchable. PostgreSQL / MySQL / SQLite · DynamoDB · S3 / MinIO · S3 Vectors · SQS / RabbitMQ / InMemory · OpenAI / Bedrock for both LLM and embeddings.
  • Architecture enforced at commit time. A pre-commit hook blocks Domain → Infrastructure imports so the DDD contract cannot rot.
  • AI-native workflows. 14 Claude Code skills + 15 Codex CLI skills sharing one AGENTS.md rules file — scaffold a domain, add a route, or audit architecture with a single command.

How it compares

Feature FastAPI Agent Blueprint tiangolo/full-stack s3rius/template teamhide/boilerplate
Zero-boilerplate CRUD (7 methods) Yes No No No
Auto domain discovery Yes No No No
Architecture enforcement (pre-commit) Yes No No No
AI workflow skills (Claude + Codex) 14 + 15 0 0 0
Vector infrastructure (S3 Vectors) Yes No No No
Multi-interface (API + Worker + Admin + MCP) 3 + 1 planned 2 1 1
Architecture Decision Records 40 0 0 0
Type-safe generics across layers Yes Partial Partial No
IoC container DI Yes No No No

Architecture at a glance

Every domain under src/{domain}/ has four DDD layers. Arrows mean "depends on". Application (use cases) is optional — the dotted line is the common path for simple CRUD (Router → Service directly).

flowchart LR
    subgraph domain["src/{domain}/  (4 DDD layers)"]
        I["Interface<br/>routers · admin · worker · schemas"]
        A["Application<br/>use cases — optional"]
        D["Domain<br/>services · protocols · DTOs · value objects"]
        Inf["Infrastructure<br/>repositories · models · DI container"]
        I --> A
        A --> D
        Inf --> D
        I -. direct when no UseCase .-> D
    end

    Core["src/_core/<br/>Base classes · CoreContainer · shared VOs"]
    I --> Core
    A --> Core
    D --> Core
    Inf --> Core

    Other["Another domain"] -. via Protocol-based DIP .-> D
Loading
Layer Role Base class
Interface Router · Request/Response · Admin · Worker task
Domain Service · Protocol · DTO · Exceptions BaseService[CreateDTO, UpdateDTO, ReturnDTO]
Infrastructure Repository · Model · DI container BaseRepository[ReturnDTO]
Application UseCase — optional orchestrator

Full set of diagrams (Layer · Write · Read) plus RDB / DynamoDB / S3 Vectors variants lives in docs/ai/shared/architecture-diagrams.md. Non-Mermaid viewers: SVG exports.

Data flow — Write (POST / PUT / DELETE)

flowchart LR
    C[Client] -->|"HTTP + JSON"| R[Router]
    R -->|"Request schema"| S[Service]
    S -->|"entity"| Re["Repository<br/>BaseRepository[DTO]"]
    Re -->|"Model(**dto.model_dump())"| M[ORM Model]
    M -->|"SQLAlchemy"| DB[(Database)]
Loading
  • Request → Service directly when fields match (no intermediate DTO — ADR 004).
  • Model ↔ DTO conversion happens only inside the Repository.
  • Read flow is the mirror image; the Router strips sensitive fields on the way out.

Storage variants

Same flow, different base classes:

Storage Service base Repository / Store base List return
RDB (default) BaseService[Create, Update, DTO] BaseRepository[DTO] (list[DTO], PaginationInfo)
DynamoDB BaseDynamoService[…] BaseDynamoRepository[DTO] CursorPage[DTO]
S3 Vectors domain-specific BaseS3VectorStore[DTO] VectorSearchResult[DTO]

Interfaces

One business logic, multiple surfaces:

Interface Tech Status Purpose
HTTP API FastAPI Stable REST endpoints
Async worker Taskiq + SQS / RabbitMQ / InMemory Stable Background jobs
Admin UI NiceGUI Stable Auto-generated admin CRUD
MCP server FastMCP Planned (#18) AI agent tool interface

AI use case: document QA (src/docs/)

The blueprint ships a worked RAG example — upload documents, ask questions, get structured answers with citations. It proves the building blocks (vectors, embeddings, LLM agent, worker, admin) compose end-to-end.

make quickstart   # terminal 1
make demo-rag     # terminal 2 — seeds 3 docs, runs a query
POST /v1/docs/documents   # chunk → embed → upsert
POST /v1/docs/query       # embed question → top-k retrieval → agent answer
GET  /admin/docs          # browse + query playground

Under the hood, the RAG orchestration is a reusable _core pattern (ADR 040), not a domain. src/docs/ is one consumer; future AI domains (support_bot, product_qa) inject the same RagPipeline instead of duplicating chunking + retrieval code:

# src/_core/domain/services/rag_pipeline.py
class RagPipeline(Generic[TChunk]):
    async def answer(self, question, top_k=5, filters=None) -> tuple[QueryAnswer, list[TChunk]]:
        ...  # embed → vector_store.search → answer_agent.answer

Zero-config path uses a stub embedder (keyword bag-of-words) and stub answer agent (templated response from retrieved chunks), both in src/_core/infrastructure/rag/. Set EMBEDDING_PROVIDER + LLM_PROVIDER in .env to swap in real providers — the pipeline is the same.


AI-native development

Both Claude Code and OpenAI Codex CLI are first-class. They share one rules file (AGENTS.md) and one workflow reference layer (docs/ai/shared/); tool-specific harnesses layer on top.

Claude Code Codex CLI
Skills 14 slash commands (.claude/skills/) 15 workflow skills (.agents/skills/)
Config CLAUDE.md + .mcp.json .codex/config.toml + .codex/hooks.json
Hooks PostToolUse auto-format 6 hooks (format · security · session-start · …)

Your first domain in 10 minutes

/onboard            # adaptive walkthrough — beginner to advanced
/new-domain product # scaffolds 15 source files + 25 __init__.py + 4 tests
/add-api "add GET /product/top-selling to product"
/review-architecture product

Swap / for $ if you are on Codex CLI. Prefer no harness at all? The "Your first domain in 10 minutes" tutorial walks both paths side-by-side — one harness command vs. 9 Python files — and ends with a passing pytest run plus curl against the real server.

Selected skills (all available in both tools): onboard, new-domain, add-api, add-worker-task, add-admin-page, review-architecture, security-review, review-pr, plan-feature, fix-bug. Full table and setup guide: docs/ai-development.md.


Learn more

I want to… Read
Spin it up and poke around docs/quickstart.md
Build a real domain, end-to-end docs/tutorial/first-domain.md
See small, pattern-focused example apps examples/
Understand the architecture in depth docs/ai/shared/architecture-diagrams.md · AGENTS.md
Set up Claude Code or Codex CLI docs/ai-development.md
Add a domain by hand (no AI tools) docs/tutorial/first-domain.md (Path B)
See detailed env vars, tech stack, project tree docs/reference.md
Understand why a decision was made ADR index (40 records)
Follow what's next Roadmap · issue tracker

Coming soon

  • MCP server interface — expose domain services as agent tools via FastMCP (#18)
  • pgvector — additional vector backend alongside S3 Vectors (#11)
  • JWT authentication (#4) · Structured logging (#9)

Contributing

See CONTRIBUTING.md for dev setup, coding guidelines, and the PR workflow. Newcomers — check the good first issue label; the small apps tracked under examples/ are a low-friction place to land your first PR.

License

MIT — free for commercial use, modification, and distribution.


Star History

Release History

VersionChangesUrgencyDate
v0.9.0The AI-collaboration harness grows from a two-tool model (Claude + Codex) to three — this release adds a repo-local **Antigravity 2.0 / Gemini CLI harness** wired to the same shared governor policy as the others. Alongside it ship three new governance frameworks (a plan→execute hard gate, a review Summary Finding Ledger, and a zero-downtime migration safety checker), a real web-search chatbot example, and a Locust performance-test harness. There is no `src/` runtime change — this is a harness, eHigh7/21/2026
v0.8.4A patch on top of v0.8.3 — the two-domain `blog` example now survives copy-into-`src/`, a permanent CI guard locks the copy-flow contract shut, plus a batch of AI-collaboration harness improvements and new HTTP middleware contract tests. Examples, tooling, and harness only, with no `src/` runtime change. ## Added - **Examples copy-flow CI guard** — `tools/check_examples_copyflow.py` (an AST static check that forbids absolute `examples.*` imports in git-tracked `examples/**/*.py`) is wired as tHigh7/5/2026
v0.8.2A small patch on top of v0.8.1 — the project's first real-LLM-calling contributor example, plus a docs note distinguishing example production surfaces. Examples and docs only, with no `src/` runtime change. ## Added - **`simple_chatbot` example** (`examples/simple_chatbot/`) — the first example that calls a real external LLM. A stateless PydanticAI `Agent` with an `output_type=ChatReply` structured output and a `StubChatbot` fallback when no LLM provider is configured (graceful degradation, ADHigh6/26/2026
v0.8.0This release simplifies admin theming down to a single Toss-style theme — a breaking change that removes the multi-preset machinery — lands two new contributor examples (`blog`, `webhook_receiver`), and clears a batch of trust-signal fixes around the worker/broker docs and fork-PR CI. Spans every change merged since v0.7.2 (2026-06-04). ## Highlights - **BREAKING — single Toss-style admin theme** — the multi-preset system is gone (the `ADMIN_THEME_PALETTE` setting/env, `_PALETTES`, `palette_prHigh6/17/2026
v0.7.2An admin code-cleanup patch on top of 0.7.1 — one bug fix plus internal tidy-ups. ## Fixed - **Admin authorization redirect** — an operator hitting a page they lack permission for was redirected to `/admin/dashboard`, a non-existent route (blank page); it now redirects to the real `/admin/` dashboard landing. (#229) ## Changed - Internal admin tidy-ups (no user-facing behavior change) — renamed the `theme.palette_accent` helper to `palette_primary` (matches its `--q-primary` return value), sHigh6/4/2026
v0.7.0This release hardens the admin and AI-agent surfaces and reworks the admin UI. Four threads: **(1) Admin security** — a separate admin-identity bounded context with its own JWT realm, server-route RBAC, a setup wizard with page-level permissions, and an audit log with a retention pipeline; **(2) AI guardrails** — OWASP LLM01/LLM07 prompt-injection defenses across the PydanticAI call sites; **(3) Admin UX** — a token-driven design system and a data-dashboard landing; **(4) Release hygiene** — CHAHigh6/2/2026
v0.6.0This release completes the production feature surface and prepares the project for OSS launch. Three themes: **(1) Production feature completion** — JWT authentication domain with refresh-token rotation, NiceGUI admin JWT + minimal RBAC, and `/docs` selector revamp with `frontend-handoff.md`; **(2) Governance maturity** — ADR 047 full rollout, harness sync advisory SOT migration; **(3) OSS launch readiness** — adoption/comparison/compatibility docs, SUPPORT.md, expanded CONTRIBUTING.md, terminalHigh5/7/2026
v0.5.0### Added - Optional OpenTelemetry tracing via the `[otel]` extra, with `OTEL_ENABLED`, `OTEL_EXPORTER_OTLP_ENDPOINT`, server/worker bootstrap wiring, and an operations recipe for Jaeger, Tempo, and Phoenix. ([#136](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/136)) - Langfuse opt-in observability recipe with `docker-compose.langfuse.yml`, `make observability-langfuse`, and HTTP exporter guidance. ([#137](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/1High4/29/2026
v0.4.0## Added - Zero-config quickstart (`make quickstart` / `make demo` / `ENV=quickstart` with SQLite + InMemory broker + auto create_all) so the blueprint can boot in under 60 seconds with no external infra ([#78](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/78)) - End-to-end RAG example as a reusable `_core` pattern (`RagPipeline`, `BaseChunkDTO` / `CitationDTO` / `QueryAnswerDTO`, `AnswerAgentProtocol`, `StubEmbedder` / `StubAnswerAgent` / `PydanticAIAnswerAgent`, `BaseInMemoryVecHigh4/21/2026
v0.3.0## Added - NiceGUI admin dashboard with auto-discovery, env-var auth, AG Grid CRUD, and field masking ([#14](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/14)) - DynamoDB support with `BaseDynamoRepository`, `DynamoModel`, and `DynamoDBClient` ([#13](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/13)) - Broker abstraction with `providers.Selector` for SQS/RabbitMQ/InMemory multi-backend ([#8](https://github.com/Mr-DooSun/fastapi-agent-blueprint/issues/8)) - Flexible RHigh4/9/2026
v0.2.0## Added - Worker Payload Schema: `BasePayload` and `PayloadConfig` for worker message contract validation ([#45](https://github.com/Mr-DooSun/fastapi-agent-blueprint/pull/45)) - Database health check endpoint with `HealthService` ([#19](https://github.com/Mr-DooSun/fastapi-agent-blueprint/pull/19)) - `/create-pr` and `/review-pr` GitHub collaboration skills ([#31](https://github.com/Mr-DooSun/fastapi-agent-blueprint/pull/31)) - Conventional commit message validation hook ([#31](https://github.High4/7/2026
v0.1.0## What's Changed * docs: CONTRIBUTING에 커밋 히스토리 안내 추가 by @Mr-DooSun in https://github.com/Mr-DooSun/fastapi-blueprint/pull/21 ## New Contributors * @Mr-DooSun made their first contribution in https://github.com/Mr-DooSun/fastapi-blueprint/pull/21 **Full Changelog**: https://github.com/Mr-DooSun/fastapi-blueprint/commits/v0.1.0Medium3/26/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

LIA-AssistantOpen-source multi-agent AI assistant powered by LangGraph, FastAPI & Next.js — 16+ agents, Human-in-the-Loop, MCP integration, voice TTS, RAG, 500+ metrics, 6 languages.v1.25.10
ouroborosStop prompting. Start specifying.v0.50.5
sugarPersistent memory for AI coding agents. Cross-session context, global knowledge, and autonomous task execution.v3.10.0
argus-mcp🔍 Enhance code quality with Argus MCP, an AI-driven code review server using a Zero-Trust model for safe and efficient development.main@2026-07-18
aiA productive AI coworker that learns, self-improves, and ships work.main@2026-07-17

More in MCP Servers

supersetCode Editor for the AI Agents Era - Run an army of Claude Code, Codex, etc. on your machine
kreuzbergA polyglot document intelligence framework with a Rust core. Extract text, metadata, images, and structured information from PDFs, Office documents, images, and 91+ formats. Available for Rust, Python
ai-engineering-from-scratchLearn it. Build it. Ship it for others.
CodeGraphContextAn MCP server plus a CLI tool that indexes local code into a graph database to provide context to AI assistants.