This project is a simplified version of the GoodReads website, implemented using Django and Django REST Framework (DRF). It provides a backend API where users can register, log in, rate books, write reviews, and bookmark books. The project is structured to be easily extendable and maintainable, following best practices and clean code principles.
- User Authentication: Register and log in using an email and password.
- Book Management: Admin users can manage books (add, edit, delete) via the Django admin panel.
- Rating and Reviews: Logged-in users can rate books (1 to 5 stars) and write reviews.
- Bookmarks: Users can bookmark books they want to read later.
- API Documentation: Provides clear and concise API endpoints for interacting with the system.
- Python 3.8+
- Django 3.2+
- Django REST Framework
- SQLite3 (default) or another database (e.g., PostgreSQL)
-
Clone the Repository:
git clone https://github.com/qzzzle/goodreads-clone.git cd goodreads-clone
-
Create a Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies:
pip install -r requirements.txt
-
Make and Run Migrations:
python manage.py makemigrations python manage.py migrate
-
Create a Superuser:
python manage.py createsuperuser
-
Run the Development Server:
python manage.py runserver
-
Access the Admin Panel:
- Go to
http://127.0.0.1:8000/admin
and log in with your superuser credentials.
- Go to
- Endpoint:
POST /account/auth/
- Payload:
{ "email": "newuser@example.com", "password": "newpassword123" }
- Endpoint:
POST /account/auth/
- Payload:
{ "email": "existinguser@example.com", "password": "existingpassword123" }
- Endpoint:
GET /books/
- Endpoint:
GET /books/<book_id>/
- Endpoint:
POST /books/<book_id>/bookmark/
- Endpoint:
POST /books/<book_id>/review/
- Payload:
{ "rating": 5, "comment": "This book is fantastic!" }
Method | Endpoint | Description |
---|---|---|
POST | /account/auth/ |
Register or log in a user |
GET | /books/ |
Get a list of all books |
GET | /books/<book_id>/ |
Get detailed information on a book |
POST | /books/<book_id>/bookmark/ |
Bookmark or unbookmark a book |
POST | /books/<book_id>/review/ |
Submit a rating and/or review |