This project is based on Michaldev's Github fastapi-async-mongodb.
Mongo DB has been configured using this articule
Quickstart
# build and run
$ docker-compose up --build
# build and run the project
$ docker-compose up --build
# run in background
$ docker-compose up -d
# delete docker images
$ docker-compose rm mongo api
# docker compose help
$ docker-compose --help
project
│ README.md
│ docker-compose.yaml
│ entry_point.py
│ Pipfile
│ Pipfile.lock
│
└───api/
│ │ __init__.py
│ │ config.py # app settings
│ │ main.py # app startup
│ │
│ └───db/
│ │ │ __init__.py
│ │ │ database_manager.py # db abstract methods
│ │ │ mongo_manager.py # actual mongo conn
│ │
│ └───models/
│ │ │ generic.py # generic pydantic models
│ │
│ └───public/ # api namespaces
│ │ │ __init__.py
│ │ │
│ │ └───health/
| │ │ models.py
| │ │ views.py
| │ │
│ │ users/
| │ │ models.py
| │ │ views.py
| │
│ └───utlis/
│ │ __init__.py
│ │ logger.py # custom logger
│
└───docker/ # mongo image initializer & api dockerfile
| │ docker-entrypoint-initdb.d/mongo-init.js
| │ Dockerfile
│
└───tavern_tests/ # api tests
│ common.yaml
│ test_user.tavern.yaml
Installs and info:
- Framework: Fastapi
- DB: MongoDB
- Container: docker-compose
- dependencies: