A CLI tool to auto-generate MongoDB connection boilerplates for FastAPI projects.
Project description
fastapi-mongo-setup
A Python CLI package that automatically creates a MongoDB connection structure for FastAPI projects.
Installation
pip install fastapi-mongo-setup
Usage
Navigate to the root of your FastAPI project and run:
mongo-setup
This command will:
- Check if the
src/utilsdirectory exists (creates it if it doesn't). - Generate a
src/utils/db.pyfile containing an asynchronousDatabaseclass usingmotor. This includesconnect_to_mongodbandclose_mongodb_connectionmethods. - Generate a
src/utils/helpers.pyfile with aserialize_docfunction to convert MongoDBObjectIdtypes to plain strings. - Automatically append
MONGODB_URLandDATABASE_NAMEvariables to your.envfile.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_mongo_setup-0.2.0.tar.gz.
File metadata
- Download URL: fastapi_mongo_setup-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f043e0071397b7d2464db628bb133023d82eb918a4acd9abfd9b9f23a3a92db4
|
|
| MD5 |
2f62b80b3546cef07fcb587484cbb221
|
|
| BLAKE2b-256 |
46509f44376c567328ceabb4cd3888900fb332fbf15b40cba63f7e456c54d46a
|
File details
Details for the file fastapi_mongo_setup-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_mongo_setup-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
932b70e2ed748b5fc4b5d5417f8ba2278b2b6df44c440f4472315025630cab52
|
|
| MD5 |
bb1f6a61984a624ec09e6b04fb77cf19
|
|
| BLAKE2b-256 |
f8520f77bc77899cc6fc7ee5b47ee90793c87df2f1b32b5c996d86a74bb0f760
|