A modern, feature-rich e-library management system built with Django REST Framework and React, featuring cloud-based file storage with Cloudinary, PostgreSQL database on NEON, and a beautiful, responsive UI with advanced reading capabilities.
- Digital Book Management: Upload, categorize, and manage books in PDF format
- Online Reading: Read books directly in the browser with progress tracking
- Cloud Storage: Secure file storage and delivery via Cloudinary CDN
- JWT Authentication: Secure token-based authentication with automatic refresh
- Advanced Search: Full-text search with filtering and sorting
- Personal Library: Like, bookmark, and track reading progress
- Analytics Dashboard: Comprehensive analytics for users and administrators
- Reading Progress Tracking: Automatic tracking of reading progress with page location and completion percentage
- Personal Dashboard: View reading history, in-progress books, completed books, and statistics
- Book Interaction: Like, bookmark, and organize favorite books
- Reading Statistics: Track reading time, pages read, and reading goals
- Responsive Reader: Optimized PDF reader with zoom and navigation controls
- Book Management: Full CRUD operations for books and categories
- User Management: View and manage user accounts with role-based access
- Rich Analytics:
- Most read books and trending content
- User activity and engagement metrics
- Popular categories and search terms
- Peak usage time analysis with interactive charts
- Content Moderation: Control book visibility and manage content
- Security: JWT token rotation, role-based permissions, secure file streaming
- Cloud Infrastructure: Cloudinary for file storage, NEON PostgreSQL database
- Real-time Updates: Optimistic UI updates with TanStack Query
- Modern UI: Beautiful, accessible design with dark mode support
- Performance: Optimized with caching (Redis), pagination, and lazy loading
- Framework: Django 4.2.7 + Django REST Framework 3.14.0
- Database: PostgreSQL (NEON Cloud Database)
- File Storage: Cloudinary (Cloud-based media storage and CDN)
- Authentication: JWT with djangorestframework-simplejwt 5.3.0
- Caching: Redis 5.0.1
- API Documentation: drf-spectacular (OpenAPI/Swagger)
- Rate Limiting: django-ratelimit
- Web Server: Gunicorn with WhiteNoise for static files
- Additional Libraries:
django-cors-headers- CORS handlingdjango-filter- Advanced filteringpsycopg[binary]- PostgreSQL adapterpython-dotenv- Environment variable managementPillow- Image processing
- Framework: React 18.3.1 with TypeScript 5.5.4
- Build Tool: Vite 5.4.0 (Fast, modern build tool)
- Routing: React Router v6.26.2
- Styling: TailwindCSS 3.4.10 with custom design system
- State Management: Zustand 4.5.5 (Lightweight state management)
- Data Fetching: TanStack Query (React Query) 5.40.0
- HTTP Client: Axios 1.7.3
- Form Handling: React Hook Form 7.51.3 with Zod validation
- Charts: Recharts 2.10.4 (for analytics visualization)
- Notifications: react-hot-toast 2.4.1
- Icons: Lucide React 0.469.0
- Utilities:
clsx- Conditional className utilitydate-fns- Date formatting and manipulation
- Deployment: Vercel (Frontend), Render/Railway (Backend)
- Database Hosting: NEON (Serverless PostgreSQL)
- File Storage: Cloudinary (Cloud-based CDN)
- Caching: Redis (for rate limiting and session management)
- Version Control: Git
E-bugema/
β
βββ backend/ # Django REST API
β βββ elibrary/ # Django project configuration
β β βββ __init__.py
β β βββ settings.py # Settings (DB, Cloudinary, JWT, CORS)
β β βββ urls.py # Main URL configuration
β β βββ wsgi.py # WSGI configuration
β β βββ asgi.py # ASGI configuration
β β
β βββ accounts/ # User authentication & management
β β βββ models.py # Custom User model
β β βββ serializers.py # User/auth serializers
β β βββ views.py # Auth endpoints (login, register, etc.)
β β βββ urls.py # Auth routes
β β βββ permissions.py # Custom permissions
β β
β βββ catalog/ # Books and categories management
β β βββ models.py # Book, Category, Author models
β β βββ serializers.py # Catalog serializers
β β βββ views.py # Book CRUD, search, filtering
β β βββ urls.py # Catalog routes
β β βββ utils.py # Helper functions
β β
β βββ reading/ # Reading progress tracking
β β βββ models.py # ReadingProgress model
β β βββ serializers.py # Progress serializers
β β βββ views.py # Progress tracking endpoints
β β βββ urls.py # Reading routes
β β βββ utils.py # Progress calculation utilities
β β
β βββ analytics/ # Analytics and event tracking
β β βββ models.py # AnalyticsEvent model
β β βββ serializers.py # Analytics serializers
β β βββ views.py # Analytics endpoints
β β βββ urls.py # Analytics routes
β β βββ middleware.py # Request tracking middleware
β β
β βββ manage.py # Django management script
β βββ requirements.txt # Python dependencies
β βββ runtime.txt # Python version specification
β βββ build.sh # Build script for deployment
β βββ seed.py # Database seeding script
β βββ env.example.txt # Environment variables template
β
βββ frontend/ # React Frontend Application
β βββ src/
β β βββ app/ # Application pages and layouts
β β β βββ layouts/ # Layout components
β β β β βββ MainLayout.tsx # Main user layout
β β β β βββ AdminLayout.tsx # Admin dashboard layout
β β β β βββ AuthLayout.tsx # Authentication pages layout
β β β β
β β β βββ pages/ # Page components
β β β βββ HomePage.tsx # Landing/home page
β β β βββ LoginPage.tsx # User login
β β β βββ RegisterPage.tsx # User registration
β β β βββ CatalogPage.tsx # Book catalog with search
β β β βββ BookDetailPage.tsx# Individual book details
β β β βββ ReaderPage.tsx # PDF reader
β β β βββ DashboardPage.tsx # User dashboard
β β β βββ ProfilePage.tsx # User profile
β β β βββ admin/ # Admin pages
β β β βββ AdminOverviewPage.tsx # Analytics overview
β β β βββ AdminBooksPage.tsx # Book management
β β β βββ AdminUsersPage.tsx # User management
β β β βββ AdminCategoriesPage.tsx# Category management
β β β
β β βββ components/ # Reusable UI components
β β β βββ cards/ # Card components
β β β β βββ StatCard.tsx # Statistics card with icons
β β β βββ catalog/ # Catalog-specific components
β β β β βββ BookCard.tsx # Book card display
β β β βββ feedback/ # User feedback components
β β β β βββ LoadingOverlay.tsx# Loading indicator
β β β βββ forms/ # Form components
β β β βββ HamburgerMenu.tsx # Mobile navigation menu
β β β βββ ProfileDropdown.tsx # User profile dropdown
β β β βββ ThemeToggle.tsx # Dark/light mode toggle
β β β βββ ProtectedRoute.tsx # Route protection wrapper
β β β
β β βββ lib/ # Core utilities and configurations
β β β βββ api/ # API client modules
β β β β βββ client.ts # Axios client with interceptors
β β β β βββ auth.ts # Authentication API calls
β β β β βββ catalog.ts # Catalog API calls
β β β β βββ reading.ts # Reading progress API
β β β β βββ analytics.ts # Analytics API calls
β β β β
β β β βββ store/ # Zustand state stores
β β β β βββ auth.ts # Authentication state
β β β β
β β β βββ types/ # TypeScript type definitions
β β β βββ index.ts # Shared type definitions
β β β
β β βββ hooks/ # Custom React hooks
β β β βββ useAutoRefreshToken.ts# Auto token refresh hook
β β β
β β βββ routes/ # Routing configuration
β β β βββ AppRoutes.tsx # Main app routes
β β β
β β βββ styles/ # Global styles
β β β βββ globals.css # Tailwind + custom styles
β β β
β β βββ App.tsx # Root App component
β β βββ main.tsx # Application entry point
β β
β βββ public/ # Static assets
β βββ index.html # HTML entry point
β βββ package.json # Node dependencies
β βββ tsconfig.json # TypeScript configuration
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ vite.config.ts # Vite build configuration
β βββ postcss.config.js # PostCSS configuration
β βββ .env.example # Frontend environment variables template
β
βββ .git/ # Git repository
βββ README.md # This file
βββ render.yaml # Render deployment configuration
βββ setup.sh # Setup script
- Python 3.11 or higher
- Node.js 18+ and npm
- PostgreSQL database (or NEON account)
- Cloudinary account
- Redis (optional, for caching)
-
Clone the repository
git clone <your-repository-url> cd E-bugema/backend
-
Create and activate virtual environment
python -m venv .venv # On Windows .venv\Scripts\activate # On Linux/Mac source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in thebackend/directory:SECRET_KEY=your-secret-key-here DEBUG=True # Database (NEON PostgreSQL) DATABASE_URL=postgresql://username:password@host/database?sslmode=require # Cloudinary Configuration CLOUDINARY_CLOUD_NAME=your-cloud-name CLOUDINARY_API_KEY=your-api-key CLOUDINARY_API_SECRET=your-api-secret # JWT Configuration JWT_ACCESS_TOKEN_LIFETIME=900 JWT_REFRESH_TOKEN_LIFETIME=604800 # CORS Configuration CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:5174,http://localhost:3000 # Redis (optional) REDIS_URL=redis://127.0.0.1:6379/1
-
Run migrations
python manage.py migrate
-
Create a superuser
python manage.py createsuperuser
-
Seed the database (optional)
python seed.py
-
Run the development server
python manage.py runserver
Backend API will be available at:
http://localhost:8000/apiAdmin panel:http://localhost:8000/adminAPI documentation:http://localhost:8000/api/docs
-
Navigate to frontend directory
cd frontend -
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in thefrontend/directory:VITE_API_URL=http://localhost:8000/api
-
Start the development server
npm run dev
Frontend will be available at:
http://localhost:5173
The API documentation is automatically generated and available at /api/docs when running the backend server.
POST /api/auth/register/- User registrationPOST /api/auth/login/- User login (returns access & refresh tokens)POST /api/auth/token/refresh/- Refresh access tokenGET /api/auth/me/- Get current user profilePATCH /api/auth/me/- Update user profilePOST /api/auth/logout/- User logout
GET /api/catalog/categories/- List all categoriesGET /api/catalog/books/- List books (supports search, filtering, pagination)GET /api/catalog/books/{id}/- Get book detailsGET /api/catalog/books/{id}/cover/- Get book cover imageGET /api/catalog/books/{id}/read/stream/- Stream book file (secure)POST /api/catalog/books/{id}/like/- Toggle book likePOST /api/catalog/books/{id}/bookmark/- Toggle book bookmark
POST /api/catalog/books/- Create a new bookPATCH /api/catalog/books/{id}/- Update book detailsDELETE /api/catalog/books/{id}/- Delete a bookGET /api/admin/users/- List all usersPOST /api/catalog/categories/- Create categoryPATCH /api/catalog/categories/{id}/- Update category
GET /api/reading/progress/{book_id}/- Get reading progress for a bookPATCH /api/reading/progress/{book_id}/- Update reading progressGET /api/reading/dashboard/- Get user's dashboard data
GET /api/analytics/admin/overview/- Admin analytics overview (charts, stats)GET /api/analytics/user/stats/- User reading statistics
- Create a Cloudinary account at cloudinary.com
- Get your Cloud Name, API Key, and API Secret from the dashboard
- Add credentials to your
.envfile - Files will be automatically uploaded to Cloudinary when books are created
- Create a NEON account at neon.tech
- Create a new project and database
- Copy the connection string
- Add to
DATABASE_URLin your.envfile
Redis is used for caching and rate limiting:
# Using Docker
docker run -d -p 6379:6379 redis:latest
# Or install locally
# Windows: Download from https://redis.io/download
# Mac: brew install redis
# Linux: sudo apt-get install redis-serverThe frontend features a modern, premium design system:
- Color Palette: Vibrant blues, emeralds, violets, ambers, and roses
- Background: Soft gray (slate-50) for reduced eye strain
- Typography: Inter font family with responsive scaling
- Components: Glassmorphism effects, gradient buttons, smooth animations
- Dark Mode: Full dark mode support with optimized colors
- Accessibility: WCAG AA compliant, keyboard navigation
- Push code to GitHub
- Connect to Render/Railway
- Set environment variables:
- All variables from
.envtemplate - Set
DEBUG=False - Set proper
CORS_ALLOWED_ORIGINS
- All variables from
- Deploy: Platform will automatically run
build.sh
- Push code to GitHub
- Import project to Vercel
- Configure:
- Framework: Vite
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
- Set environment variable:
VITE_API_URL=<your-backend-url>/api - Deploy
- JWT Authentication: Secure token-based auth with automatic rotation
- Role-Based Access Control: Separate admin and user permissions
- Secure File Streaming: Cloudinary signed URLs with expiration
- Rate Limiting: Protection against API abuse
- CORS Protection: Configured allowed origins
- Input Validation: Comprehensive validation on all endpoints
- SQL Injection Protection: Django ORM prevents SQL injection
- XSS Protection: React automatically escapes output
cd backend
python -m pytestcd frontend
npm run test- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
- Advanced reading features (annotations, highlights, bookmarks with notes)
- Social features (reviews, ratings, book discussions)
- Reading challenges and achievement badges
- Personalized AI-powered book recommendations
- Offline reading support (PWA)
- Mobile app (React Native)
- Advanced analytics and export features
- Multi-language support
- EPUB reading support
- Audio book support
For questions and support:
- Create an issue in the repository
- Email: support@e-bugema.com
Built with β€οΈ using Django, React, PostgreSQL, and Cloudinary