Skip to main content

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/utils directory exists (creates it if it doesn't).
  • Generate a src/utils/db.py file containing an asynchronous Database class using motor. This includes connect_to_mongodb and close_mongodb_connection methods.
  • Generate a src/utils/helpers.py file with a serialize_doc function to convert MongoDB ObjectId types to plain strings.
  • Automatically append MONGODB_URL and DATABASE_NAME variables to your .env file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_mongo_setup-0.2.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_mongo_setup-0.2.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Hashes for fastapi_mongo_setup-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f043e0071397b7d2464db628bb133023d82eb918a4acd9abfd9b9f23a3a92db4
MD5 2f62b80b3546cef07fcb587484cbb221
BLAKE2b-256 46509f44376c567328ceabb4cd3888900fb332fbf15b40cba63f7e456c54d46a

See more details on using hashes here.

File details

Details for the file fastapi_mongo_setup-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_mongo_setup-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 932b70e2ed748b5fc4b5d5417f8ba2278b2b6df44c440f4472315025630cab52
MD5 bb1f6a61984a624ec09e6b04fb77cf19
BLAKE2b-256 f8520f77bc77899cc6fc7ee5b47ee90793c87df2f1b32b5c996d86a74bb0f760

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page