A modern, production-ready template for building APIs with Python 3.8+ using FastAPI. This template provides a modular structure and includes a TODO list CRUD example to demonstrate best practices.
- 🚀 FastAPI for high-performance API development
- 📁 Modular project structure
- 🔍 Example TODO list CRUD implementation
- 📝 Auto-generated API documentation (Swagger/OpenAPI)
- ✨ Clean, maintainable architecture
- 🔒 Type safety with Pydantic models
- Python 3.8 or higher
- pip (Python package installer)
-
Clone the template:
git clone https://github.com/yourusername/fastapi-template.git cd fastapi-template -
Create and activate virtual environment:
# Create virtual environment python -m venv venv # Windows .\venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
-
Open http://localhost:8000/docs to view the API documentation
fastapi-template/ ├── main.py # Application entry point ├── requirements.txt # Project dependencies ├── models/ # Data models │ └── todo.py # TODO models └── routes/ # API routes └── todo_routes.py # TODO endpoints
The template includes a complete TODO list API:
GET /todos- List all todosPOST /todos- Create a todoGET /todos/{id}- Get a specific todoPUT /todos/{id}- Update a todoDELETE /todos/{id}- Delete a todo
We welcome contributions! Here's how to contribute to this project:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Test your changes
- Commit with clear messages:
git commit -m "feat: add new feature"
- Push to your fork:
git push origin feature/your-feature-name
- Go to the original repository and create a Pull Request
- Fill in the PR template with:
- Description of changes
- Related issue(s)
- Testing performed
- Screenshots (if applicable)
- Follow existing code style
- Add tests for new features
- Update documentation
- One feature per PR
- Keep PRs focused and manageable in size
- Follow PEP 8 guidelines
- Use type hints
- Write docstrings for functions and classes
- Keep functions focused and single-purpose
This project is licensed under the MIT License - see the LICENSE file for details.
- Check the FastAPI documentation
- Open an issue for bugs
- Start a discussion for questions