Skip to content

Docker image with FastAPI with users management, ready for production 🚀

License

Notifications You must be signed in to change notification settings

JeremyAndress/fastapi-docker

Repository files navigation

Test license Profile

Features ✨

  • FastAPI framework.
  • Interactive API documentation
  • Full Docker integration.
  • Docker Compose integration.
  • Production ready Python web server using Uvicorn.
  • Secure password hashing by default.
  • JWT token authentication.
  • SQLAlchemy models
  • CORS (Cross Origin Resource Sharing).
  • Small utility to paginate SqlAlchemy queries.

Requirements 📌

  • Docker 🐳
  • docker-compose 🐳
  • Python 3.6+ 🐍 To use without docker

Quick Start 🌱

Run FastAPI Docker ⚡ Local Development

  1. git clone https://github.com/JeremyAndress/fastapi-docker.git
  2. Create .env files cp .env.example .env

You should now have a directory structure like:

.
├── compose
│   ├── local
│   ├── production
│   ├── scripts
│   └── stage
├── nginx
│   └── site.conf
├── requirements
│   ├── local.txt
│   ├── migrations.txt
│   ├── mysql.txt
│   ├── postgre.txt
│   ├── production.txt
│   └── test.txt
├── screenshots
│   └── ui.png
├── src
│   ├── alembic
│   ├── api
│   ├── core
│   ├── db
│   ├── logs
│   ├── models
│   ├── __pycache__
│   ├── schemas
│   ├── tests
│   ├── utils
│   ├── alembic.ini
│   ├── main.py
│   ├── pre_start.py
│   └── prestart.sh
├── CHANGELOG.md
├── LICENSE
├── .env.example
├── .flake8
├── local.yml
├── production.yml
├── pytest.ini
├── README.md
└── stage.yml
  1. docker-compose -f local.yml build
  2. docker-compose -f local.yml up -d
  3. That's just all, api server is listen at http://localhost:8030/docs now

You will see the automatic interactive API documentation (provided by Swagger UI): Swagger UI

Testing 🚨

    pytest -vvs src/tests/