Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A simple, secure web-based note-taking application built with Flask. Create, manage, and organize your personal notes with user authentication and a clean, responsive interface.

Notifications You must be signed in to change notification settings

vinay-ghate/NotesBuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notes App - MongoDB Version

A simple Flask web application for managing personal notes, now powered by MongoDB with improved architecture and security.

Features

  • 🔐 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

Setup Instructions

Prerequisites

  • Python 3.7+
  • MongoDB Atlas account (or local MongoDB installation)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd notes-app
  2. Install dependencies

    pip install -r requirements.txt
  3. Environment Configuration

    Copy the example environment file and configure your settings:

    cp .env.example .env

    Then edit .env with 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 .env file to version control. It contains sensitive credentials and is already included in .gitignore.

  4. Initialize Database

    python init_db.py
  5. Run the Application

    python main.py

    The app will be available at http://localhost:5000

Project Structure

├── 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

Key Improvements

Code Architecture

  • 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

Security

  • Password hashing: Using bcrypt for secure password storage
  • Input validation: Email format validation and data sanitization
  • Environment variables: Sensitive data stored in .env file

Database

  • MongoDB: Replaced SQLite with MongoDB for better scalability
  • Indexes: Automatic index creation for performance
  • Connection management: Proper connection handling

User Experience

  • 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

API Endpoints

  • GET / - Home page (requires login)
  • POST / - Create new note
  • GET /login - Login page
  • POST /login - Process login
  • GET /sign-up - Registration page
  • POST /sign-up - Process registration
  • GET /logout - Logout user
  • POST /delete-note - Delete note (AJAX)
  • GET /checkHealth - Health check endpoint

Technology Stack

  • 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

Usage

  1. Sign Up: Create a new account with email and password
  2. Login: Access your personal note dashboard
  3. Add Notes: Use the textarea to create new notes
  4. Delete Notes: Click the delete button to remove notes instantly

Development

To run in development mode:

export FLASK_ENV=development
python main.py

For production deployment, set:

export FLASK_ENV=production

Database Schema

The application uses two main collections:

Users Collection

{
  _id: ObjectId,
  email: String (unique),
  first_name: String,
  password: String (bcrypt hashed),
  created_at: Date
}

Notes Collection

{
  _id: ObjectId,
  data: String,
  user_id: String,
  date: Date
}

Security Features

  • Bcrypt password hashing
  • User session management with Flask-Login
  • Route protection with @login_required decorator
  • User authorization checks for note operations
  • Input validation and sanitization
  • Environment-based configuration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is open source and available under the MIT License.

About

A simple, secure web-based note-taking application built with Flask. Create, manage, and organize your personal notes with user authentication and a clean, responsive interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published