fastapi-templates

Create FastAPI projects with async patterns, dependency injection, and repository architecture.

Updated Sep 14, 2026
One-click install
npx skills add https://github.com/desarrolloainia/nuevo_circuito_mir --skill fastapi-templates-desarrolloainia
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: fastapi-templates
Source: https://github.com/desarrolloainia/nuevo_circuito_mir/tree/main/backend/.agents/skills/fastapi-templates
Command: npx skills add https://github.com/desarrolloainia/nuevo_circuito_mir --skill fastapi-templates-desarrolloainia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up a new FastAPI backend from scratch involves many architectural decisions—project layout, async database sessions, authentication, and testing—that are easy to get wrong and time-consuming to scaffold repeatedly. ## Core Features & Use Cases - Layered Project Structure: Provides a complete app layout with API routers, core config, models, schemas, services, and repositories. - Async CRUD & Auth Patterns: Includes a generic async SQLAlchemy repository, service layer with password hashing, JWT authentication, and dependency-injected endpoints. - Testing Setup: Ships pytest fixtures with an in-memory SQLite async database and httpx AsyncClient for endpoint tests. - Use Case: When starting a new microservice, ask for a FastAPI project scaffold and receive working code for user CRUD endpoints with JWT auth, async PostgreSQL sessions, and tests. ## Quick Start Create a new FastAPI project with async SQLAlchemy, JWT authentication, and a user CRUD endpoint following the repository pattern.

Frequently Asked Questions about fastapi-templates

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

FAQPage Schema
How do I structure a FastAPI project for production?▼

Structure a FastAPI project with separate directories for API routers, core configuration, database models, Pydantic schemas, services, and repositories. This layered layout keeps route handlers thin and business logic testable.

How to use dependency injection in FastAPI with async database sessions?▼

FastAPI dependency injection uses Depends with a generator function that yields an AsyncSession from sessionmaker. The dependency commits on success, rolls back on exceptions, and closes the session after each request.

Does FastAPI support JWT authentication with OAuth2?▼

FastAPI supports JWT authentication via OAuth2PasswordBearer and the python-jose library. A get_current_user dependency decodes the token, extracts the user ID, and loads the user from the database for protected endpoints.

How do I test async FastAPI endpoints with pytest?▼

Test async FastAPI endpoints using httpx AsyncClient with pytest-asyncio fixtures. Override the get_db dependency to inject an in-memory SQLite async session so tests run isolated from the real database.

What is the repository pattern in FastAPI and when should I use it?▼

The repository pattern in FastAPI encapsulates database queries in generic classes typed by model and schema. Use it when multiple endpoints share CRUD logic, though simple prototypes may not need this extra abstraction layer.