FastAPI Patterns
Production-grade FastAPI: project layout, Pydantic v2, dependency injection, auth, and pytest with httpx.
- What
- Production-grade FastAPI: project layout, Pydantic v2, dependency injection, auth, and pytest with httpx.
- Cost
- Free
- Needs
- Use "FastAPI Patterns" with your Muse.
- Install
- Copy the installer prompt below into your Muse — your agent does the rest.
Curated by Skill Harbor: modern, production-grade FastAPI development patterns. Covers the full slice: project layout with an app factory and lifespan management, settings via pydantic-settings, shared dependencies, SQLAlchemy engine and session handling, routers split by domain, separate Pydantic request/response schemas versus ORM models, and a transactional service layer for business logic. Then the cross-cutting concerns: dependency injection done right, async handlers, authentication and authorization, CORS and middleware, and testing with httpx and pytest (including the conftest patterns that make API tests fast and isolated). The guide is explicit about where beginners cut corners, like creating tables on startup for demos versus managing schemas with Alembic migrations in strict production. By @affaan-m, listed here with credit to its creator. From the affaan-m/ECC repository (MIT). Honest caveats: Python and FastAPI only; the async SQLAlchemy patterns assume a modern stack (Pydantic v2, SQLAlchemy 2.x), older codebases will need adaptation. Skill Harbor never reviews the code, review it yourself before use.
Version:
Install
Copy the install package below, then paste it into MuseCommunity-built. Skill Harbor doesn't audit code — review the source before installing.
Use "FastAPI Patterns" with your Muse. Prerequisites: the Muse app (mobile or web), and a Python/FastAPI project to build or review. Pure guidance skill, nothing to install. 1. Open the skill: https://github.com/affaan-m/ECC/blob/main/skills/fastapi-patterns/SKILL.md and copy the full SKILL.md text. 2. Paste it into a chat with Muse and add: "Review [this FastAPI app / this router] against these patterns: [paste code or repo path]. Focus on [project structure / Pydantic schemas / auth / tests]." 3. Ask Muse to propose the corrected layout (app factory, lifespan, dependencies, service layer) and the pytest + httpx test scaffolding. Tip: the split between Pydantic schemas and SQLAlchemy models is the single most violated rule in real FastAPI codebases. Fix that first. Safety: a skill is plain-text instructions; it runs nothing by itself. Review any code before committing it, never paste secrets into a chat, and review anything Muse proposes before it acts.
Saved to your recent installs. Find it anytime on /connect.
Questions
How do I install a build?
Every product page includes a copy-paste install prompt. Paste it into your Muse and it sets the build up for you — no manual configuration.
Where does my money go?
Straight to the seller. Skill Harbor never processes payments: checkout happens on the seller’s own page, usually Stripe.
What does the ✓ next to a creator’s name mean?
It means we confirmed the identity of the person behind the listing. It says nothing about the code itself — always check a build before installing it.