Skip to content

mosesoyediran/docker-fastapi-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŒͺ️ Hello FastAPI β€” Example FastAPI + Docker App

Build Status Docker FastAPI Python Version


This project is a minimal FastAPI app, Dockerized and ready to be used as a base for your next project, or as a guide to Dockerize your existing FastAPI app.

It wires up a lot of real-world components without overloading the project with too many personal preferences.


⚑ Stack:

  • FastAPI 0.111.0
  • Python 3.13.2

πŸ“š Table of Contents


βš™οΈ Tech Stack

Back-end

Front-end


πŸš€ Running the App

1. Clone the Repo

git clone https://github.com/your-username/your-repo.git hellofastapi
cd hellofastapi

2. Build and Start

docker compose up --build

Note:

  • First build will take 5–10 minutes.
  • Ensure Docker Compose v2.20.2+.
  • Change DOCKER_WEB_PORT_FORWARD in .env if port 8000 is in use.
  • Adjust UID and GID if permission errors on Linux.

3. Set Up the Database

In another terminal:

./run fastapi db reset --with-testdb

4. Visit in Browser

http://localhost:8000

πŸ› οΈ Development Commands

Linting

./run lint

Formatting

./run format

Testing

./run test

Combo Command

./run quality

πŸ“¦ Managing Dependencies

  • List outdated:
./run uv:outdated
./run yarn:outdated
  • Install new packages:
Option 1
  1. Edit pyproject.toml or assets/package.json.
  2. Run:
./run deps:install
Option 2
  1. CLI Add:
./run uv add mypackage --no-sync
./run yarn add mypackage --no-lockfile
  1. Then install:
./run deps:install

🎨 Front-end Choices

Choose any depending on your app:


🧐 Notable Opinions and Extensions

Feature Details
App Server uvicorn
ORM SQLAlchemy
Migrations Alembic
Linting ruff
Testing pytest + pytest-cov
Routing / page and /up health check routes
Config Management .env + config/settings.py
Docker Full multi-stage builds
CI GitHub Actions setup
Package Manager uv
Assets TailwindCSS, esbuild, Heroicons

πŸ“š Additional Resources

Learn More:

Deploy to Production:


πŸ‘¨β€πŸ’» About the Author

Thanks for checking out this project. Feel free to fork, clone, or suggest improvements!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors