This is a full-stack web application built as the capstone project for Harvard's CS50x. It allows users to securely register, log in, and manage their personal notes.
This enhanced version includes Full CRUD (Create, Read, Update, Delete) functionality, Flash Messages for user feedback, and a Dark Mode toggle.
- Backend: Python, Flask
- Database: SQL (SQLite, accessed through the CS50
SQLlibrary) - Frontend: HTML, CSS, Bootstrap 5, Jinja2 templates, JavaScript (for Dark Mode)
- Security: Password hashing (
werkzeug.security, scrypt hashes) and server-side sessions (Flask-Session) signed with a secret key from the environment.
- Secure user registration and login system.
- Full CRUD: Users can Create, Read, Update (Edit), and Delete their own notes.
- Dark Mode: A toggle in the navbar to switch between light and dark themes, with the user's preference saved in
localStorage. - Flash Messages: User-friendly alerts for actions like "Note added!", "Note deleted!", etc.
- Notes are tied to individual user accounts; every read/update/delete query is scoped to the logged-in user.
- Responsive design using Bootstrap.
The entry point of the application is application.py (the app object is named app in it).
-
Clone the repository:
git clone https://github.com/abedmohamed258/CS50-Final-Project.git cd CS50-Final-Project -
(Recommended) Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Provide a session signing key.
SECRET_KEYis required: the app reads it from the environment and refuses to start without it (there is deliberately no hardcoded fallback, so session cookies can never be forged from a value committed to this public repository). Copy.env.exampleto.envand fill it in (.envis git-ignored), or just export it:export SECRET_KEY="$(python3 -c 'import secrets; print(secrets.token_hex(32))')"
-
Tell Flask where the app lives and run it. Note that a bare
flask rundoes not work here, because Flask's auto-discovery only looks forapp.py/wsgi.py, notapplication.py:export FLASK_APP=application.py flask runThen open http://127.0.0.1:5000/ in your browser.
(The application automatically creates the
notes.dbSQLite file and itsusers/notestables on first run if they don't exist yet.)
application.py # Flask app, routes, DB schema bootstrap
helpers.py # apology() and login_required() (CS50 conventions)
templates/ # Jinja2 templates (layout, index, add, edit, login, register, apology)
static/ # styles.css and dark-mode.js
requirements.txt # Flask, Flask-Session, cs50, Werkzeug
.env.example # template for required environment variables (SECRET_KEY)
This project is licensed under the GNU General Public License v3.0 or later — see LICENSE.
Copyright (C) 2025 Abed Mohamed.
Attribution note: the application's authentication scaffolding follows the
conventions of the CS50 "Finance" starter code (apology() and
login_required() in helpers.py, the application.py session setup, and
templates/apology.html), and the database layer uses the cs50 library
from cs50.library. The note-taking feature set (the notes schema and the
add/edit/delete/index routes and templates, the flash-message UI and the dark
mode) is the author's own work.