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.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

smart-coding-mcp🔍 Enhance code search accuracy with Smart Coding MCP, an AI-driven server that uses intelligent embeddings for quick, relevant results.main@2026-06-07
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-06-07
aiA productive AI coworker that learns, self-improves, and ships work.main@2026-06-06
zotero-mcp-lite🚀 Run a high-performance MCP server for Zotero, enabling customizable workflows without cloud dependency or API keys.main@2026-06-01
ouroborosStop prompting. Start specifying.v0.40.1

More in MCP Servers

agentroveYour own Claude Code UI, sandbox, in-browser VS Code, terminal, multi-provider support (Anthropic, OpenAI, GitHub Copilot, OpenRouter), custom skills, and MCP servers.
node9-proxyThe Execution Security Layer for the Agentic Era. Providing deterministic "Sudo" governance and audit logs for autonomous AI agents.
mcp-compressorAn MCP server wrapper for reducing tokens consumed by MCP tools.
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.