Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Book Tracker

A full-stack Book Tracker web application built with Node.js, Express.js, PostgreSQL, EJS, HTML, and CSS. The application allows users to maintain a personal reading journal by adding books, rating them, writing notes, and managing their reading history. Book covers are automatically fetched using the Open Library Covers API based on the ISBN number.


✨ Features

  • 📖 Add new books with complete details
  • ⭐ Rate books from 1 to 5
  • 📝 Save personal notes and reviews
  • 📅 Record the date a book was read
  • 🔢 Store ISBN numbers
  • 🖼️ Automatically display book covers using ISBN
  • ✏️ Update book ratings and notes
  • 🗑️ Delete books from the collection
  • 📊 Display books sorted by highest rating
  • 💾 Store all data in PostgreSQL
  • 🎨 Clean and responsive user interface

🛠️ Tech Stack

Frontend

  • HTML5
  • CSS3
  • EJS

Backend

  • Node.js
  • Express.js
  • Body Parser

Database

  • PostgreSQL

External API

  • Open Library Covers API

📂 Project Structure

Book-Tracker/
│
├── public/
│   └── styles.css
│
├── views/
│   └── index.ejs
│
├── index.js
├── package.json
├── package-lock.json
└── README.md

⚙️ Installation

1. Clone the Repository

git clone https://github.com/yourusername/book-tracker.git
cd book-tracker

2. Install Dependencies

npm install

3. Create PostgreSQL Database

CREATE DATABASE "My books";

Create the table:

CREATE TABLE book (
    id SERIAL PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    author VARCHAR(255),
    rating INTEGER,
    date_read DATE,
    isbn VARCHAR(20),
    notes TEXT
);

4. Configure Database

Update the PostgreSQL connection in index.js.

const db = new pg.Client({
    user: "postgres",
    host: "localhost",
    database: "My books",
    password: "your_password",
    port: 5432
});

5. Start the Server

node index.js

or

nodemon index.js

Visit:

http://localhost:3000

🚀 How It Works

Home Page

Displays all books stored in the PostgreSQL database.

Books are automatically sorted by highest rating.


Add Book

Users can add:

  • Book Title
  • Author Name
  • Rating
  • Date Read
  • ISBN Number
  • Personal Notes

The information is stored in PostgreSQL.


Book Cover

The application automatically loads the book cover using the ISBN.

Example:

https://covers.openlibrary.org/b/isbn/9781612620244-M.jpg

Edit Book

Users can update:

  • Rating
  • Notes

Changes are immediately saved to the database.


Delete Book

Books can be permanently removed from the collection.


🗄️ Database Schema

Column Type
id SERIAL PRIMARY KEY
title VARCHAR(255)
author VARCHAR(255)
rating INTEGER
date_read DATE
isbn VARCHAR(20)
notes TEXT

📸 Screenshots

Add

screenshots/
│
├── home.png
├── add-book.png
├── edit-book.png
└── delete-book.png

📦 Dependencies

{
  "dependencies": {
    "axios": "^1.x",
    "body-parser": "^1.x",
    "ejs": "^3.x",
    "express": "^4.x",
    "pg": "^8.x"
  }
}

🎨 UI Features

  • Responsive layout
  • Card-based design
  • Automatic book cover preview
  • Beautiful color palette
  • Easy-to-use forms
  • Smooth hover animations

🔮 Future Improvements

  • 🔍 Search books by title
  • 📚 Filter by author or rating
  • ❤️ Favorite books
  • 🌙 Dark Mode
  • 📱 Better mobile responsiveness
  • 🔐 User authentication
  • ☁️ Deploy to Render/Railway
  • 📈 Reading statistics dashboard
  • 📄 Export books to PDF or CSV
  • 🌐 Fetch complete book details from Open Library API

🐞 Known Issues

Current code has a small issue in the delete route.

Current query:

DELETE FROM books WHERE id = $1;

Correct query:

DELETE FROM book WHERE id = $1;

Also, make sure the Edit form is properly closed before starting the Delete form in index.ejs.


👨‍💻 Author

Rahul Pawar

Engineering Student | Full Stack Web Developer


📄 License

This project is licensed under the MIT License.


⭐ If you found this project helpful, don't forget to Star the repository!

About

A Book Tracking Web Application built using Node.js, Express.js, and PostgreSQL that allows users to store and manage book details such as title, author, rating, reading notes, date completed, and ISBN number. The app helps users organize their reading history through a simple and interactive interface.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages