fastapi-templates
by wshobsonCreate production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Overview
What is fastapi-templates?
fastapi-templates provides a set of production-ready project templates and best practices for building FastAPI backend applications. It is designed for Python developers who want to quickly scaffold new FastAPI projects with a robust structure, async support, dependency injection, and integrated error handling. This skill is ideal for teams or individuals starting new backend API projects, microservices, or web services that require scalable and maintainable codebases.
Who should use fastapi-templates?
- Backend developers working with Python and FastAPI
- Teams launching new REST APIs or microservices
- Projects needing async database support (PostgreSQL, MongoDB)
- Anyone seeking a proven project structure for FastAPI applications
Problems solved by fastapi-templates
- Eliminates the need to design project structure from scratch
- Promotes best practices for async programming and dependency injection
- Reduces setup time for new FastAPI projects
- Helps ensure consistency and maintainability across backend services
How to Use
Installation Steps
-
Add the skill to your project using the following command:
npx skills add https://github.com/wshobson/agents --skill fastapi-templates -
Review the main documentation files:
- Start with
SKILL.mdfor a high-level overview and usage notes. - Check
README.md,AGENTS.md, andmetadata.jsonfor additional context and configuration details. - Explore the
rules/,resources/,references/, andscripts/directories for supporting materials and helper scripts.
- Start with
Project Structure Overview
The recommended layout includes:
app/api/for API routes and dependenciesapp/core/for configuration, security, and database setupapp/models/for database modelsapp/schemas/for Pydantic schemasapp/services/for business logicapp/repositories/for data accessapp/main.pyas the application entry point
This structure supports scalable development and clear separation of concerns.
Adapting fastapi-templates to your workflow
- Use the provided templates as a starting point, then customize for your specific requirements.
- Integrate your preferred database (PostgreSQL, MongoDB) and authentication methods as needed.
- Leverage FastAPI's dependency injection system for modular and testable code.
FAQ
When should I use fastapi-templates?
Use fastapi-templates when starting a new FastAPI backend project, especially if you want async support, a clean project structure, and built-in best practices. It's suitable for both REST APIs and microservices.
What databases are supported?
The templates are designed to work well with async databases such as PostgreSQL and MongoDB, but can be adapted for other backends.
Can I use fastapi-templates for existing projects?
While primarily intended for new projects, you can adopt parts of the structure and best practices in existing FastAPI codebases.
Where do I find more details?
Open the Files tab in the skill directory to browse the full file tree, including nested references and helper scripts. Start with SKILL.md for a guided overview.
