Authors : @Ruben, @Raïssa & @Hélène
BookHub is a collaborative book tracking web application built with PHP, PostgreSQL, and Vanilla JS. It allows users to manage their personal library, post reviews, search for books, and explore the most loved titles in the community.
- Features
- Technologies Used
- Project Structure
- Functional Overview
- PostgreSQL Setup
- Installation & Execution
- License
- 📚 Book Management: Add, edit, delete books with cover images and metadata.
- 🔍 Search System: Search by title, author, or genre.
- ⭐ Reviews: Leave a rating and a comment on any book.
- ✅ Authentication: Register, login, logout and manage your profile.
- 🎒 User Library: Add or remove books from your personal collection.
- 🎲 Random Book Feature: Homepage showcases a random featured book.
- 🔝 Top Rated Books: Homepage highlights the best rated books in the community.
- 🔐 Route Protection: Restricted pages for authenticated users only.
- 🎨 Custom Styles: Clean and responsive UI.
- PHP 8+
- PostgreSQL
- Vanilla JavaScript
- Composer
- HTML5 & CSS3
- Dotenv (env management)
/app
│── Controllers/ # MVC Controllers
│── Models/ # Database access logic
│── Views/ # All HTML views (organized by page)
│── Core/ # Custom router & database connection
/public
│── uploads/ # Uploaded book cover images
│── assets/ # CSS and JS files
│── index.php # Main entry point
/.env # Environment variables (DB credentials)
/composer.json # PHP dependencies
| Method | Route | Description |
|---|---|---|
| GET | / |
Homepage with featured + top books |
| GET | /books |
List all books |
| GET | /books/add |
Add a new book (form) |
| POST | /books/add |
Submit a new book |
| GET | /books/:id |
Show a specific book |
| POST | /books/:id |
Post a review |
| POST | /books/:id/add |
Add book to user’s collection |
| POST | /books/:id/remove |
Remove book from user’s collection |
| GET | /mes-livres |
Show user's owned books |
| POST | /reviews/delete/:id |
Delete one of your reviews |
| GET | /login, /register |
Auth routes |
| POST | /login, /register |
Auth submissions |
| GET | /profil |
Show and update profile |
| POST | /profil |
Update profile info |
| POST | /password |
Update password |
- Create the bookhub database:
CREATE DATABASE bookhub;- Execute the schema:
-- Table creation
-- Users, Authors, Genres, Books, Reviews, User_BooksYou’ll find the full schema in the database.sql file.
git clone https://github.com/RubnK/PHP_BookHub.git
cd PHP_BookHubcomposer installCreate a .env file at the root and set:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=bookhub
DB_USER=your_user
DB_PASSWORD=your_password
Since it's a pure PHP project:
php -S localhost:8000 -t publicOpen http://localhost:8000 in your browser.
This project is licensed under the MIT License