fastapi-templates

Generates production-ready FastAPI project structures with async patterns, dependency injection, and testing.

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/filippolmt/skills --skill fastapi-templates-filippolmt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastapi-templates
Source: https://github.com/filippolmt/skills/tree/main/skills/fastapi-templates
Command: npx skills add https://github.com/filippolmt/skills --skill fastapi-templates-filippolmt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up a new FastAPI backend from scratch involves many architectural decisions—project layout, async database sessions, dependency injection, authentication, and testing—that are easy to get wrong and slow to scaffold manually. ## Core Features & Use Cases - Layered Project Structure: Provides a recommended layout separating API routes, core config, models, schemas, services, and repositories. - Async Patterns & Dependency Injection: Covers async route handlers, SQLAlchemy async sessions, and FastAPI's Depends-based DI for database and auth. - Worked Implementation Patterns: Includes complete examples for CRUD repositories, service layers, JWT authentication, and pytest async test fixtures. - Use Case: When starting a new microservice, ask for a FastAPI project scaffold and receive a structured codebase with user CRUD endpoints, JWT auth, and an async test suite. ## Quick Start Ask the assistant to scaffold a new FastAPI project with async SQLAlchemy, JWT authentication, and a pytest test setup using this skill.

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?

Use a layered layout separating api routes, core config, models, schemas, services, and repositories. This skill provides that structure with an app/ directory containing api/v1 endpoints, core database and security modules, and a main.py entry point.

How to implement dependency injection in FastAPI?

FastAPI's built-in Depends system injects database sessions, authentication, and configuration into route handlers. The skill demonstrates a get_db dependency yielding async SQLAlchemy sessions and a get_current_user dependency for JWT-authenticated requests.

How do I test async FastAPI endpoints with pytest?

Use pytest-asyncio with httpx AsyncClient and override the get_db dependency to point at an in-memory SQLite database via aiosqlite. The skill includes conftest.py fixtures for event loops, database sessions, and test clients.

Does FastAPI support async database operations with SQLAlchemy?

Yes, SQLAlchemy's async engine and AsyncSession work natively with FastAPI async route handlers. The skill shows create_async_engine setup, session lifecycle management with commit and rollback, and a generic async CRUD repository.

How do I add JWT authentication to a FastAPI API?

Create access tokens with python-jose using HS256, hash passwords with passlib bcrypt, and protect routes with an OAuth2PasswordBearer dependency. The skill provides complete security.py and dependencies.py implementations.