A clean and minimalistic authentication system built using Flask and MongoDB, implementing:
- 💼 User registration
- 🔑 Session-based login
- 🔄 Password reset flow
- 🔐 Secure password hashing
- 🔓 Logout functionality
All powered by a simple Flask backend and organized with modular routes and secure practices.
- Flask – Lightweight Python web framework
- MongoDB – NoSQL database accessed via
pymongo - bcrypt – Secure password hashing
- Flask sessions – Manages authentication state
- dotenv – Secure environment variable configuration
- Jinja2 + HTML – Server-side templates for UI
login\_db/
├── app.py # Main Flask application
├── .env # Environment variables (e.g., MONGO\_URI, SECRET\_KEY)
├── requirements.txt # Dependencies
└── templates/ # HTML templates
├── register.html
├── login.html
├── forgot.html
├── reset.html
└── dashboard.html
└── README.md
- Securely stores unique users with bcrypt-hashed passwords in MongoDB.
- Session-based login using Flask’s secure session management.
- Username-based password reset flow with automatic bcrypt hashing.
- Uses .env for database credentials and secret keys.
I wanted a clean, modular login backend to use as a foundation for other projects or CI/CD pipelines. This is a learning exercise to:
- Learn Flask session management
- Securely handle authentication workflows
- Structure backend routes cleanly and maintainably :contentReference[oaicite:1]{index=1}
git clone https://github.com/theritikbarnwal/cloudmaster.git
cd DevOps/cloudmaster
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Create a .env file with MONGO_URI and SECRET_KEY
python app.py
- 🛡️ Secure password storage with bcrypt
- 🔗 Flask sessions to maintain login state
- 🗂️ Route structure for login, registration, and password reset
- 🔐 Using environment variables responsibly with
dotenv - 🗃️ Basic MongoDB interactions using
pymongo
- Integrate an email-based password reset flow
- Package and Dockerize the app
- Add CI/CD pipeline (e.g., GitHub Actions)
- Deploy to a cloud platform (Railway or Render)
- Original Dev.to article: Building a Clean Flask Login System with MongoDB, Sessions, and Password Reset (dev.to)
If you have suggestions—whether for the password reset flow, route structure, or Dockerization—feel free to open an issue or pull request. Always open to learning and improving!
---
### ✅ Why This Works:
- 🎯 **Clarity**: Highlights what the project does, why it matters, and how to run it.
- 🛠 **Tech Stack**: Lists all tools and frameworks used.
- 🧩 **Modular Structure**: Shows readers how the project is organized.
- 🔄 **Future Improvements**: Indicates your roadmap and ambition.
Feel free to adjust any section or add images, screenshots, or badges.
::contentReference[oaicite:13]{index=13}