Library management system Built with Django REST Framework
Library Service is a web-based application designed to manage books, borrowings, and users in a library. The system allows librarians to track books, monitor borrowings, handle overdue notifications, and manage user accounts efficiently.
The project improves workflow by providing structured API endpoints, automated daily notifications for overdue borrowings, and comprehensive test coverage to ensure reliability. It follows Django and DRF best practices, including viewsets, serializers, permissions, and Celery for background tasks.
- Docker
- Docker Compose
- Python 3.10+ (for local testing, optional)
- PostgreSQL (if not using Docker defaults)
- Redis (for Celery tasks, if not using Docker defaults)
git clone https://github.com/yourusername/library-service.git
cd library-service
docker-compose up --buildIf you run app for the first time, there will be a notification from Stripe in the console with a
link to authentication. By clicking on the link you need to authenticate, log in to your
account, copy and add STRIPE_PUBLIC_KEY and STRIPE_SECRET_KEY to the .env file.
(you will probably have to restart the docker with command docker-compose up)
After that, there will be a message like this:
Ready! You are using Stripe API Version ...
Your webhook signing secret is .....
this password must be inserted into the .env file to STRIPE_WEBHOOK_SECRET.
After that, you don't need to do anything on subsequent launches.
The application will be available at:
### Creating Superuser and Loading Fixtures
Create a superuser inside the Docker container:
```bash
docker-compose exec library python manage.py createsuperuser
Load initial demo data fixture:
docker-compose exec library python manage.py loaddata fixtures/initial_data.jsonThe project supports Telegram notifications via a bot.
- Open Telegram and start a chat with @BotFather
- Create a new bot using
/newbot - Save the generated BOT_TOKEN
- Start a chat with your bot or add the bot to group chat as admin
- Send any message to it
- Open in browser:
https://api.telegram.org/bot<BOT_TOKEN>/getUpdates(paste your BOT_TOKEN) - Copy the
chat.idvalue
Add the following variables to your .env file:
TELEGRAM_BOT_TOKEN="your_bot_token"
TELEGRAM_CHAT_ID="your_chat_id"docker-compose exec library python manage.py test- JWT Authentication system for users
- CRUD for Books and Borrowings
- View and manage overdue borrowings
- Daily notifications for overdue borrowings (via Celery + Redis)
- Swagger documentation for API endpoints
- Search, filtering, and pagination for list views
- Permissions: admin-only modifications, read-only for other users
- Optimized database queries with
select_relatedandprefetch_related - Unit tests for core functionality
- Custom
AUTH_USER_MODEL(users.User) - Database configuration via
settings.py - Celery & Redis configuration for background tasks
- Global pagination settings
- Shared base templates for API browsable interface