A simple Flask web application for managing personal notes, now powered by MongoDB with improved architecture and security.
- 🔐 User Authentication: Secure signup and login with bcrypt password hashing
- 📝 Personal Notes: Create and manage private notes tied to your account
- ⚡ Real-time Operations: Delete notes instantly with smooth animations
- 🌙 Dark Professional Theme: Modern, elegant dark UI with smooth transitions
- 📱 Responsive Design: Works perfectly on desktop, tablet, and mobile
- 🗄️ MongoDB Integration: Scalable NoSQL database with proper indexing
- 🏗️ Class-based Architecture: Clean, maintainable code with docstrings
- 🔧 Environment Configuration: Secure configuration management
- ✨ Enhanced UX: Loading states, confirmations, and smooth animations
- Python 3.7+
- MongoDB Atlas account (or local MongoDB installation)
-
Clone the repository
git clone <repository-url> cd notes-app
-
Install dependencies
pip install -r requirements.txt
-
Environment Configuration
Copy the example environment file and configure your settings:
cp .env.example .env
Then edit
.envwith your actual MongoDB connection details:MONGODB_URI=your_mongodb_connection_string_here SECRET_KEY=your_secret_key_here DATABASE_NAME=notes_app
⚠️ Security Note: Never commit your.envfile to version control. It contains sensitive credentials and is already included in.gitignore. -
Initialize Database
python init_db.py
-
Run the Application
python main.py
The app will be available at
http://localhost:5000
├── main.py # Application entry point
├── init_db.py # Database initialization script
├── requirements.txt # Python dependencies
├── .env # Environment variables
└── website/
├── __init__.py # App factory and configuration
├── config.py # Configuration classes
├── models.py # MongoDB models (User, Note)
├── auth.py # Authentication routes and logic
├── views.py # Main application routes
├── static/
│ └── index.js # Frontend JavaScript
└── templates/ # HTML templates
├── base.html
├── home.html
├── login.html
└── sign_up.html
- Class-based design: Controllers and models are organized in classes
- Docstrings: All methods have comprehensive docstrings
- Type hints: Added for better code documentation
- Error handling: Proper exception handling throughout
- Password hashing: Using bcrypt for secure password storage
- Input validation: Email format validation and data sanitization
- Environment variables: Sensitive data stored in .env file
- MongoDB: Replaced SQLite with MongoDB for better scalability
- Indexes: Automatic index creation for performance
- Connection management: Proper connection handling
- Dark Professional Theme: Modern GitHub-inspired dark theme
- Smooth Animations: Elegant transitions and loading states
- Better Error Messages: More informative user feedback with icons
- Input Validation: Client and server-side validation
- Responsive Design: Optimized for all screen sizes
- Enhanced Interactions: Confirmation dialogs and visual feedback
GET /- Home page (requires login)POST /- Create new noteGET /login- Login pagePOST /login- Process loginGET /sign-up- Registration pagePOST /sign-up- Process registrationGET /logout- Logout userPOST /delete-note- Delete note (AJAX)GET /checkHealth- Health check endpoint
- Backend: Flask (Python web framework)
- Database: MongoDB with PyMongo driver
- Authentication: Flask-Login with bcrypt password hashing
- Frontend: Bootstrap + jQuery for responsive UI
- Configuration: python-dotenv for environment management
- Sign Up: Create a new account with email and password
- Login: Access your personal note dashboard
- Add Notes: Use the textarea to create new notes
- Delete Notes: Click the delete button to remove notes instantly
To run in development mode:
export FLASK_ENV=development
python main.pyFor production deployment, set:
export FLASK_ENV=productionThe application uses two main collections:
{
_id: ObjectId,
email: String (unique),
first_name: String,
password: String (bcrypt hashed),
created_at: Date
}{
_id: ObjectId,
data: String,
user_id: String,
date: Date
}- Bcrypt password hashing
- User session management with Flask-Login
- Route protection with
@login_requireddecorator - User authorization checks for note operations
- Input validation and sanitization
- Environment-based configuration
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.