Kickstart your project with a FastAPI MongoDB Boilerplate ✨
Share
Long description
MicroBlog 🗳
Kickstart your project with a FastAPI MongoDB Boilerplate ⏳
Getting Started 📍
- Based on FastAPI 🚀
- Structured into modules for easy re-use 📦
- Using MongoDB as a database 💾
- Easy to add custom data 📦
- Typing with Pydantic 💡
- Deployment using Uvicorn ⚙
- Token-based authentication using PyJWT 🔑
- A full CRUD API Dockerized 🐳
Running the Application Locally 🚀
- Drop your MongoDB Configuration & Token at the
.env.sample
and Don't Forget to change the Name to.env
DB_HOST # MongoDB Host
DB_PORT # MongoDB Port
MONGO_USER # MongoDB User
MONGO_PASSWORD # MongoDB Password
MONGO_DB # MongoDB Database
SECRET_KEY # JWT Secret Key
ACCESS_TOKEN_EXPIRE_MINUTES # JWT Access Token Expire Minutes
- To run the Main we need to use uvicorn a lightning-fast ASGI server implementation, using uvloop and httptools.
# run the main app using uvicorn
$ uvicorn main:app --reload
Running the Application in Docker 🐳
- We have the Dockerfile created in the above section. Now, we will use the Dockerfile to create the image of the FastAPI app and then start the application container.
- I provide a simplified way by Using a Pre-configured
Makefile
just write in your CLImake help
and use the commands. - Don't forget to change the configuration if you want to run the app in a different host or port.