{"id":26993171,"url":"https://github.com/sage-rebirth/flask-mongodb","last_synced_at":"2026-05-09T06:31:36.161Z","repository":{"id":285940187,"uuid":"959834510","full_name":"SAGE-Rebirth/flask-mongodb","owner":"SAGE-Rebirth","description":"This project demonstrates how to integrate Flask with MongoDB, enabling seamless database interactions for web applications. It provides step-by-step guidance on setting up a MongoDB cluster, configuring access, and connecting it to a Flask application.","archived":false,"fork":false,"pushed_at":"2025-04-03T12:39:16.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T13:37:20.281Z","etag":null,"topics":["flask","flask-api","flask-application","flask-backend","mongodb","mongodb-atlas","mongodb-database","mongodb-driver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAGE-Rebirth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-03T12:33:36.000Z","updated_at":"2025-04-03T12:48:53.000Z","dependencies_parsed_at":"2025-04-03T13:47:27.692Z","dependency_job_id":null,"html_url":"https://github.com/SAGE-Rebirth/flask-mongodb","commit_stats":null,"previous_names":["sage-rebirth/flask-mongodb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAGE-Rebirth%2Fflask-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAGE-Rebirth%2Fflask-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAGE-Rebirth%2Fflask-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAGE-Rebirth%2Fflask-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAGE-Rebirth","download_url":"https://codeload.github.com/SAGE-Rebirth/flask-mongodb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248069520,"owners_count":21042661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","flask-api","flask-application","flask-backend","mongodb","mongodb-atlas","mongodb-database","mongodb-driver"],"created_at":"2025-04-03T23:16:45.055Z","updated_at":"2026-05-09T06:31:36.105Z","avatar_url":"https://github.com/SAGE-Rebirth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask \u0026 MongoDB Integration\n\n## Table of Contents\n1. [Creating a Free MongoDB Cluster](#creating-a-free-mongodb-cluster)\n2. [Configuring Database Access](#configuring-database-access)\n3. [Setting Up Network Access](#setting-up-network-access)\n4. [Setting Up Flask](#setting-up-flask)\n5. [Running the Flask Application](#running-the-flask-application)\n6. [Bonus \u0026 Notes](#bonus--notes)\n\n## Creating a Free MongoDB Cluster\n1. Go to MongoDB Atlas and create a new cluster.\n2. Choose the **free plan**, provide a **unique name** for the cluster.\n3. Select a cloud provider (**AWS, Azure, or GCP**) and choose a region (e.g., **Mumbai (ap-south-1)**).\n4. Click **Create** to finalize the setup.\n\n## Configuring Database Access\n1. Create a **new database** and provide a **unique name**.\n2. Add a **collection name** (must be unique as well).\n3. Add a **user** for authentication.\n4. If you haven't created a user, create one now.\n\n### Setting Up Database Access\n1. Navigate to **Security \u003e Database Access**.\n2. Click **Add New Database User**.\n3. Choose an authentication method (**password-based** authentication recommended).\n4. Enter a **username and password** (save them for later use).\n5. Assign a **role** with **Read \u0026 Write Access**.\n\n### Bonus \u0026 Notes\n- You can **add a temporary database user** for limited-time access (**6 hours - 1 week**).\n\n## Setting Up Network Access\n1. Go to **Security \u003e Network Access \u003e IP Access List**.\n2. Click **Add IP Address**.\n3. Add your **current IP address**.\n\n### Bonus:\n- You can **add temporary IP addresses** for limited-time access.\n- For learning purposes, you can set **0.0.0.0/0** (Allows access from anywhere).\n- A faster way is using **Security \u003e Quickstart**, where you’ll find all necessary options.\n\n## Setting Up Flask\n### Installing Required Packages\n1. Install dependencies using:\n   ```sh\n   pip install -r requirements.txt\n   ```\n2. Alternatively, create a virtual environment and install dependencies:\n   ```sh\n   python -m venv flask-app-env\n   flask-app-env\\Scripts\\activate  # Windows\n   pip install -r requirements.txt\n   ```\n\n### Configuring Environment Variables\nCreate a **.env** file and add the following details:\n```sh\nMONGO_URI= \"Enter your MongoDB Connection String\"\nMONGO_DB_NAME= \"Enter Database Name\"\nMONGO_COLLECTION_NAME= \"Enter Collection Name\"\nSECRET_KEY= \"Enter your Secret Key (Random Alpha-Numeric)\"\n```\n\n#### Notes:\n- **SECRET_KEY** is used for session management, encryption, and CSRF protection.\n- Rename **sample.env** to **.env** before running the application.\n\n## Running the Flask Application\nRun the application using one of the following commands:\n```sh\nflask run\n```\nOR\n```sh\npython app.py\n```\n\n---\nThis guide ensures a smooth integration of **Flask with MongoDB** for your application. 🚀\nYou can contribute to this demo app, submit PRs 👍","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage-rebirth%2Fflask-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsage-rebirth%2Fflask-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsage-rebirth%2Fflask-mongodb/lists"}