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.1.0.tar.gz (2.7 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.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_mongo_setup-0.1.0.tar.gz.

File metadata

  • Download URL: fastapi_mongo_setup-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 2be6001705f3ecba0700e9bb13a772ca3f0ca1d90a8b2fede7a335a59c4a0dd4
MD5 1d7b95b0b082d55fbdc1ef0fbb8af1d4
BLAKE2b-256 e88c272dd239f3b92865f105a163da5bb118f8c71ea798b161166c27430e904c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_mongo_setup-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f022380ee8eadeceb013bf3ae43074c5c6e16c91505ab8568932e80721b70e5
MD5 0bcb183687038b04f4d8f2900fa4c955
BLAKE2b-256 4f529c406b73e832625788372b836db6b02040a40600ec4a72b28822f8c117d1

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