A simple but fully functional Notes Application built with FastAPI, Jinja2 templates, SQLAlchemy, and session-based authentication. Users can sign up, log in, create notes, and delete notes, with each user having their own private notes.
- User registration & login (session-based authentication)
- Protected routes using FastAPI dependencies
- Create and delete personal notes
- Flash messages for success & error notifications
- Jinja2 templates for frontend rendering
- SQLAlchemy ORM for database models
- Project structure similar to Flask but powered by FastAPI
- Fully compatible with GitHub deployment & local development
-
FastAPI
-
Jinja2 Templates
-
SQLAlchemy ORM
-
Starlette Session Middleware
-
HTML, CSS, JavaScript
-
SQLite (default)
Notes-Application/ │ ├── .env ├── .gitignore ├── LICENSE ├── main.py ├── README.md ├── requirements.in ├── requirements.txt ├── TREE.md │ ├── screenshots/ │ ├── home.png │ ├── login.png │ ├── signup.png │ ├── delete_note.png │ └── structure.png │ └── website/ ├── init.py ├── auth.py ├── database.py ├── hashing.py ├── models.py ├── schemas.py ├── testing.py ├── views.py │ ├── static/ │ └── index.js │ └── templates/ ├── base.html ├── home.html ├── login.html └── sign_up.html
git clone https://github.com/WambuaMalcolm/Notes-Application.git
cd <repo-name>python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windowspip install -r requirements.txtpython main.pyGo to: 👉 http://127.0.0.1:8000
🔐 Authentication Flow
This project uses session cookies (not JWT). When a user logs in:
Their user_id is stored inside the session
get_current_user() retrieves the user from the DB
Protected routes use dependencies to check authentication
Uses PostgreSQL
Tables are automatically created on startup:
models.Base.metadata.create_all(bind=engine)
Create a Note
Form submission via POST
Validated on backend
Saved to database
Immediately displayed on home page
Delete a Note
Each note has a delete button that sends:
fetch(/delete-note/${noteId}, { method: "POST" })
Deletion is restricted to the note owner.
Description
It shows
-
Add Note form
-
List of notes
-
❌ delete icons beside each note
-
Flash messages after logging in
Description
Displays the login form where users enter email and password then redirected to home page to access their notes.
Description
Shows the registration page where new users create an account.
- AJAX-based note updates
- Better UI styling
- Password reset
- Tagging system
- User profile page
Pull requests are welcome! If you find bugs or want improvements, feel free to open an issue.
This project is open-source and available under the MIT License.


