https://github.com/mongodb-developer/pymongo-fastapi-crud
PyMongo with FastAPI CRUD application
https://github.com/mongodb-developer/pymongo-fastapi-crud
crud fastapi mongodb pymongo
Last synced: 5 months ago
JSON representation
PyMongo with FastAPI CRUD application
- Host: GitHub
- URL: https://github.com/mongodb-developer/pymongo-fastapi-crud
- Owner: mongodb-developer
- License: apache-2.0
- Created: 2022-03-08T18:58:06.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T21:10:11.000Z (about 2 years ago)
- Last Synced: 2025-04-07T19:21:12.855Z (9 months ago)
- Topics: crud, fastapi, mongodb, pymongo
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 145
- Watchers: 9
- Forks: 54
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# PyMongo with FastAPI CRUD application
This is a simple CRUD application built using PyMongo and FastAPI. You can also follow the step-by-step [tutorial](https://www.mongodb.com/languages/python/pymongo-tutorial) for building this application.
## Running the server
Set your [Atlas URI connection string](https://docs.atlas.mongodb.com/getting-started/) as a parameter in `.env`. Make sure you replace the username and password placeholders with your own credentials.
```
ATLAS_URI=mongodb+srv://:@sandbox.jadwj.mongodb.net
DB_NAME=pymongo_tutorial
```
Install the required dependencies:
```
python -m pip install -r requirements.txt
```
Start the server:
```
python -m uvicorn main:app --reload
```
When the application starts, navigate to `http://localhost:8000/docs` and try out the `book` endpoints.
## Running the tests
Install `pytest`:
```
python -m pip install pytest
```
Execute the tests:
```
python -m pytest
```
## Disclaimer
Use at your own risk; not a supported MongoDB product