Skip to content
Projects

mongodb-developer/mongodb-with-fastapi has 356 GitHub stars and 165 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-17 03:29 UTC. Last push 2025-07-15.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Update delayed
in 15 days
Update delayed
in 1 month
Update delayed

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Example of using MongoDB with FastAPI

Developer Tools

README.md

Original

MongoDB with FastAPI

This is a small sample project demonstrating how to build an API with MongoDB and FastAPI. It was written to accompany a blog post - you should go read it!

If you want to fastrack your project even further, check out the MongoDB FastAPI app generator and eliminate much of the boilerplate of getting started.

TL;DR

If you really don't want to read the blog post and want to get up and running, activate your Python virtualenv, and then run the following from your terminal (edit the MONGODB_URL first!):

# Install the requirements:
pip install -r requirements.txt

# Configure the location of your MongoDB database:
export MONGODB_URL="mongodb+srv://<username>:<password>@<url>/<db>?retryWrites=true&w=majority"

# Start the service:
uvicorn app:app --reload

(Check out MongoDB Atlas if you need a MongoDB database.)

Now you can load http://localhost:8000/docs in your browser ... but there won't be much to see until you've inserted some data.

If you have any questions or suggestions, check out the MongoDB Community Forums!