fastapi-ddd

Implement FastAPI endpoints using Domain-Driven Design patterns and clean architecture.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/koenvorster/Personal_project_VorstersNV --skill fastapi-ddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastapi-ddd
Source: https://github.com/koenvorster/Personal_project_VorstersNV/tree/main/.claude/skills/fastapi-ddd
Command: npx skills add https://github.com/koenvorster/Personal_project_VorstersNV --skill fastapi-ddd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a clear blueprint for implementing FastAPI endpoints using Domain-Driven Design patterns, aligning API routes, domain services, aggregates, and repositories into a coherent architecture to reduce coupling and improve testability.

Core Features & Use Cases

  • App factory & lifecycle: guidance on creating a FastAPI app with a lifespan context manager and DI integration.
  • DDD patterns: guidance on organizing aggregates, repositories, services, and domain events.
  • Pydantic v2: examples of schemas and validation aligned with async SQLAlchemy models.
  • Testing & migrations: structure for pytest async tests and Alembic migration workflow.

Quick Start

Start by scaffolding a FastAPI project with an app factory, then wire a simple CRUD domain using a single aggregate and repository.

Frequently Asked Questions about fastapi-ddd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a FastAPI project using Domain-Driven Design patterns?

Structure a FastAPI project using Domain-Driven Design by organizing API routes, domain services, aggregates, and repositories into a clean architecture. This blueprint aligns modules to reduce coupling and improve testability across typical CRUD-based projects.

What is the best way to set up a FastAPI app factory with dependency injection?

The best way to set up a FastAPI app factory is using a lifespan context manager integrated with dependency injection. This approach manages application lifecycle events while wiring domain aggregates and repositories into API endpoints.

Can I use Pydantic v2 schemas with async SQLAlchemy models in a clean architecture?

Yes, you can use Pydantic v2 schemas with async SQLAlchemy models in a clean architecture. Schemas handle validation and interface directly with async database models to separate domain logic from data persistence.

How do I configure Alembic migrations for an async SQLAlchemy FastAPI project?

Configure Alembic migrations for an async SQLAlchemy FastAPI project by following a structured workflow that coordinates schema changes with async database models. This ensures domain aggregates remain synchronized with database state.

Does this FastAPI DDD skill include patterns for async pytest testing?

Yes, this FastAPI DDD skill includes patterns for async pytest testing. It provides a testing structure that validates domain services and repositories within the clean architecture blueprint, ensuring API modules function correctly.

When should I use aggregates and repositories in a FastAPI application?

Use aggregates and repositories in a FastAPI application when reducing coupling and improving testability across domain logic is required. They encapsulate business rules and data access, separating them from API route definitions.