| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Table of contents
Bookly (aka BookClub API) is a Django REST Framework backend that powers a social reading/book-exchange platform. It provides user authentication (email + Google OAuth), profile management, book management, genres, and an exchange/book-request flow.
This README was generated from an analysis of the repository code and aims to provide a concise, actionable reference for local development and integration.
Prerequisites
git clone https://github.com/Kiprotich-Code/bookly.git
cd booklypython3 -m venv .venv
source .venv/bin/activateIf requirements.txt exists in your root, install it. If not, install the common dependencies used by the project:
pip install django djangorestframework djangorestframework-simplejwt django-cors-headers django-allauth dj-rest-authpython manage.py migrate
python manage.py createsuperuserpython manage.py runserverThe API will be available at http://127.0.0.1:8000/ by default.
The project stores Django settings in bookclub_api/settings.py. Relevant configuration items:
Environment variables and secrets (e.g., SECRET_KEY, GOOGLE_CLIENT_ID) are expected to be provided in your environment or a .env file (not included).
Start the server locally
python manage.py runserverAccess the Django admin at /admin/ after creating a superuser.
Root mounting points (from bookclub_api/urls.py):
Accounts endpoints (accounts/urls.py):
Books endpoints (router at /books/):
Exchange endpoints (router at /exchange/):
This project uses Token Authentication by default. When a user registers or logs in, the API returns a token. Include it in requests with the header:
Authorization: Token <token>
Example: fetch current user's profile
GET /accounts/user/profile/
Authorization: Token b42cb92f8851c1aa7320d53fc9fce2318f7dccfeResponse shape (abridged):
{
"user": {
"id": 2,
"username": "James",
"email": "james@gmail.com",
"name": "James",
"bio": "Test bio!",
"location": "Nairobi, Kenya",
"favorite_genres": ["Fiction","Non-Fiction","Science Fiction","Fantasy","Mystery"],
"profile_picture": null,
"member_since": "2025-07-05T18:12:57.227096Z",
"privacy_settings": {"show_email": true, "show_location": true, "show_reading_stats": true},
"reading_goal": 12,
"books_read": 0,
"total_swaps": 0,
"average_rating": 0
},
"token": "b42cb92f8851c1aa7320d53fc9fce2318f7dccfe"
}Register (email):
curl -X POST http://127.0.0.1:8000/accounts/auth/register/ \
-H "Content-Type: application/json" \
-d '{"username":"james","email":"james@gmail.com","password":"securepass"}'Login (email):
curl -X POST http://127.0.0.1:8000/accounts/auth/login/ \
-H "Content-Type: application/json" \
-d '{"type":"email","email":"james@gmail.com","password":"securepass"}'Get profile (JS fetch example):
fetch('/accounts/user/profile/', {
headers: { 'Authorization': `Token ${token}` }
})
.then(r => r.json())
.then(console.log)Recommended development workflow
Run Django tests with:
python manage.py testbookclub_api/ # Django project accounts/ # custom user, auth, profile books/ # book and genre models, viewsets copies/ # exchange / request flow manage.py db.sqlite3 # local sqlite DB (development)
Contributions are welcome. Please open issues for bugs or feature requests and submit pull requests for fixes.
This project is licensed under the MIT License — see LICENSE for details.
| Back | FazBrowse Home | New Git URL |