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.3.1.tar.gz (4.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.3.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_mongo_setup-0.3.1.tar.gz
  • Upload date:
  • Size: 4.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.3.1.tar.gz
Algorithm Hash digest
SHA256 8ca963503bd6158b37bb508d6e2fb3cf9cf08e115b371a6384b87bdcab6a0426
MD5 1ad571236c01b643f9e9004ac09eab15
BLAKE2b-256 77ea83f005a985b8677432c66769342dbaab848b99dcf98fdb26f6b4b3cb312e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_mongo_setup-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7917f0cc1dcf17a71b5f462369dd5ee4525ea2f1769978359360b211df6b9fea
MD5 6d50a738cb51c2d27d59cde6331250be
BLAKE2b-256 82664ef33803575160a27eb65a2fa0e76a89805651dc8820ff8ba8f2e74c60c0

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