This is a simple web application to track books you've read and add notes for each book.
It uses Node.js + Express, PostgreSQL for the database, and EJS for rendering views.
- 📖 View all books you've read.
- ➕ Add a new book with title, ISBN, author, rating, review, and date read.
- 📝 Add notes for a specific book.
- ✏️ Edit book details (title, author, rating, review, date).
- ❌ Delete books or delete notes.
- 🖼️ Auto-fetch book cover images based on ISBN.
- ⚡ Nice logging of all server activity (requests and responses).
- ❗ Custom error pages (404 and 500 errors).
- Backend: Node.js, Express
- Database: PostgreSQL
- Templating Engine: EJS
git clone https://github.com/Ibn-Maged/book-notes.git
cd book-notesnpm installCreate a .env file in the root directory and add your PostgreSQL credentials:
PG_USER=your_postgres_username
PG_HOST=your_database_host
PG_DATABASE=your_database_name
PG_PASSWORD=your_database_password
PG_PORT=5432You need two tables:
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title VARCHAR(255),
isbn VARCHAR(20),
date_read DATE,
rating INTEGER,
review TEXT,
author VARCHAR(255)
);
CREATE TABLE notes (
id SERIAL PRIMARY KEY,
note TEXT,
book_id INTEGER REFERENCES books(id) ON DELETE CASCADE
);node server.js