Quick Start
Create your first FastAPI project with FastAPI-fastkit in under 5 minutes!
Not sure which starter to pick?
See Which starter should I choose? for a
beginner-friendly comparison of startdemo templates and interactive
architecture presets (minimal / single-module / classic-layered
/ domain-starter). The short answer: fastkit init --interactive
with the domain-starter preset is the recommended modern default.
1. Create Project
Use FastAPI-fastkit's init command to create a new project:
$ fastkit init
Enter the project name: my-first-app
Enter the author name: Your Name
Enter the author email: your.email@example.com
Enter the project description: My first FastAPI application
Project Information
┌──────────────┬─────────────────────────────┐
│ Project Name │ my-first-app │
│ Author │ Your Name │
│ Author Email │ your.email@example.com │
│ Description │ My first FastAPI application│
└──────────────┴─────────────────────────────┘
Available Stacks and Dependencies:
MINIMAL Stack
┌──────────────┬───────────────────┐
│ Dependency 1 │ fastapi │
│ Dependency 2 │ uvicorn │
│ Dependency 3 │ pydantic │
│ Dependency 4 │ pydantic-settings │
└──────────────┴───────────────────┘
STANDARD Stack
┌──────────────┬───────────────────┐
│ Dependency 1 │ fastapi │
│ Dependency 2 │ uvicorn │
│ Dependency 3 │ sqlalchemy │
│ Dependency 4 │ alembic │
│ Dependency 5 │ pytest │
│ Dependency 6 │ pydantic │
│ Dependency 7 │ pydantic-settings │
└──────────────┴───────────────────┘
FULL Stack
┌──────────────┬───────────────────┐
│ Dependency 1 │ fastapi │
│ Dependency 2 │ uvicorn │
│ Dependency 3 │ sqlalchemy │
│ Dependency 4 │ alembic │
│ Dependency 5 │ pytest │
│ Dependency 6 │ redis │
│ Dependency 7 │ celery │
│ Dependency 8 │ pydantic │
│ Dependency 9 │ pydantic-settings │
└──────────────┴───────────────────┘
Select stack (minimal, standard, full): minimal
Available Package Managers:
Package Managers
┌────────┬────────────────────────────────────────────┐
│ PIP │ Standard Python package manager │
│ UV │ Fast Python package manager │
│ PDM │ Modern Python dependency management │
│ POETRY │ Python dependency management and packaging │
└────────┴────────────────────────────────────────────┘
Select package manager (pip, uv, pdm, poetry) [uv]: uv
Do you want to proceed with project creation? [y/N]: y
✨ FastAPI project 'my-first-app' has been created successfully!
2. Activate Virtual Environment
Navigate to your project and activate the virtual environment:
3. Start Development Server
Start the FastAPI development server:
Congratulations!
Your FastAPI server is now running! Open your browser to check it out.
4. Test Your API
Open your browser and visit these URLs:
Main Endpoint
Visit http://127.0.0.1:8000
You'll see:
Interactive API Documentation
Visit http://127.0.0.1:8000/docs
This is the automatically generated Swagger UI documentation where you can:
- See all your API endpoints
- Test endpoints directly in the browser
- View request/response schemas
Alternative Documentation
Visit http://127.0.0.1:8000/redoc
This is the ReDoc documentation interface with a different, clean design.
5. Add Your First Route
Let's add a new API route to your project:
$ fastkit addroute users my-first-app
Adding New Route
┌──────────────────┬──────────────────────────────────────────┐
│ Project │ my-first-app │
│ Route Name │ users │
│ Target Directory │ ~/my-first-app │
└──────────────────┴──────────────────────────────────────────┘
Do you want to add route 'users' to project 'my-first-app'? [Y/n]: y
╭──────────────────────── Info ────────────────────────╮
│ ℹ Updated main.py to include the API router │
╰──────────────────────────────────────────────────────╯
╭─────────────────────── Success ───────────────────────╮
│ ✨ Successfully added new route 'users' to project │
│ `my-first-app` │
╰───────────────────────────────────────────────────────╯
The server will automatically reload, and now you have new endpoints:
GET /api/v1/users/- Get all usersPOST /api/v1/users/- Create a new userGET /api/v1/users/{user_id}- Get a specific userPUT /api/v1/users/{user_id}- Update a userDELETE /api/v1/users/{user_id}- Delete a user
6. Test the New API
Using curl
Get all users:
Create a new user:
Using the Interactive Docs
- Visit http://127.0.0.1:8000/docs
- Expand the "users" section
- Click on "POST /api/v1/users/"
- Click "Try it out"
- Fill in the request body:
- Click "Execute"
7. Explore Your Project Structure
Your generated project has a clean, organized structure:
my-first-app/
├── .venv/ # Virtual environment
├── src/
│ ├── __init__.py
│ ├── main.py # FastAPI app entry point
│ ├── core/
│ │ ├── __init__.py
│ │ └── config.py # App configuration
│ ├── api/
│ │ ├── __init__.py
│ │ ├── api.py # API router collection
│ │ └── routes/
│ │ ├── __init__.py
│ │ ├── items.py # Default items route
│ │ └── users.py # Your new users route
│ ├── crud/
│ │ ├── __init__.py
│ │ ├── items.py # CRUD operations for items
│ │ └── users.py # CRUD operations for users
│ ├── schemas/
│ │ ├── __init__.py
│ │ ├── items.py # Pydantic schemas for items
│ │ └── users.py # Pydantic schemas for users
│ └── mocks/
│ ├── __init__.py
│ └── mock_items.json # Test data
├── tests/ # Test files
├── scripts/ # Utility scripts
├── requirements.txt # Python dependencies
├── setup.py # Package configuration
└── README.md # Project documentation
8. Package Manager Options
FastAPI-fastkit supports multiple Python package managers to suit your preferences:
Available Package Managers
| Manager | Description | Best For |
|---|---|---|
| UV | Fast Python package manager (default) | Speed and performance |
| PDM | Modern Python dependency management | Advanced dependency resolution |
| Poetry | Python dependency management and packaging | Poetry-based workflows |
| PIP | Standard Python package manager | Traditional Python development |
Specifying Package Manager
You can specify your preferred package manager in several ways:
1. Interactive Selection (Default)
When you run fastkit init or fastkit startdemo, you'll be prompted to choose:
$ fastkit init
# ... after project details and stack selection ...
Available Package Managers:
Package Managers
┌────────┬────────────────────────────────────────────┐
│ PIP │ Standard Python package manager │
│ UV │ Fast Python package manager │
│ PDM │ Modern Python dependency management │
│ POETRY │ Python dependency management and packaging │
└────────┴────────────────────────────────────────────┘
Select package manager (pip, uv, pdm, poetry) [uv]: uv
2. Command Line Option
Skip the interactive prompt by specifying the package manager directly:
Dependency Files Generated
Each package manager creates its appropriate dependency files:
- UV/PDM:
pyproject.toml(PEP 621 format) - Poetry:
pyproject.toml(Poetry format) - PIP:
requirements.txt
9. What's Next?
Congratulations! You've successfully:
✅ Created your first FastAPI project ✅ Started the development server ✅ Added a new API route ✅ Tested your APIs
Continue Learning
- Your First Project: Build a more complex blog API
- Creating Projects: Learn about different stacks and options
- Adding Routes: Master the art of API development
- Using Templates: Explore pre-built project templates
Experiment More
Try these commands to explore more features:
Development Tips
- The server automatically reloads when you change files
- Always check the interactive docs at
/docswhen adding new features - Use the virtual environment to keep dependencies isolated
- Explore the generated code to understand the project structure