Skip to content

WambuaMalcolm/Notes-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 Notes-Application

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.

🚀 Features

  • 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

📌 Tech Stack

  • FastAPI

  • Jinja2 Templates

  • SQLAlchemy ORM

  • Starlette Session Middleware

  • HTML, CSS, JavaScript

  • SQLite (default)

📁 Project Structure

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

⚙️ Installation & Setup

1️⃣ Clone the repository

git clone https://github.com/WambuaMalcolm/Notes-Application.git
cd <repo-name>

2️⃣ Create and activate a virtual environment

python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows

3️⃣ Install dependencies

pip install -r requirements.txt

4️⃣ Run the application

python main.py

5️⃣ Open in browser

Go 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

🗄️ Database

Uses PostgreSQL

Tables are automatically created on startup:

models.Base.metadata.create_all(bind=engine)

Notes CRUD

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.

📷 Screenshots

1. Home Page

Home page

Description

It shows

  • Add Note form

  • List of notes

  • ❌ delete icons beside each note

  • Flash messages after logging in

2. Login page

Login page

Description

Displays the login form where users enter email and password then redirected to home page to access their notes.

3. Sign Up Page

Sign Up page

Description

Shows the registration page where new users create an account.

🧩 Future Improvements

  • AJAX-based note updates
  • Better UI styling
  • Password reset
  • Tagging system
  • User profile page

🤝 Contributing

Pull requests are welcome! If you find bugs or want improvements, feel free to open an issue.

📝 License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors