Backend API service for EduText - A digital textbook management system for Yaba College of Technology.
- 📚 Textbook Management
- 🛒 Order Processing
- 👥 User Authentication & Authorization
- 📊 Sales & Inventory Reports
- 🔍 Search & Filtering
- 📱 RESTful API
- Python 3.8+
- PostgreSQL
- pip
- Clone the repository
- Install dependencies
- Configure database settings
- Run migrations
- Start the server
backend/ ├── api/ # Main API application │ ├── views/ # API views and viewsets │ ├── serializers/ # Data serializers │ ├── models/ # Database models │ └── urls.py # API URL configurations ├── core/ # Core application settings ├── media/ # User uploaded files ├── static/ # Static files └── manage.py # Django management script
Create a .env
file in the root directory with the following variables:
env DEBUG=True SECRET_KEY=your-secret-key DATABASE_URL=postgresql://user:password@localhost:5432/edutext ALLOWED_HOSTS=localhost,127.0.0.1 CORS_ALLOWED_ORIGINS=http://localhost:3000
POST /api/v1/auth/login/
- User loginPOST /api/v1/auth/register/
- User registrationGET /api/v1/auth/profile/
- Get user profile
GET /api/v1/textbooks/
- List all textbooksPOST /api/v1/textbooks/
- Create new textbookGET /api/v1/textbooks/{id}/
- Get textbook detailsPUT /api/v1/textbooks/{id}/
- Update textbookDELETE /api/v1/textbooks/{id}/
- Delete textbook
GET /api/v1/orders/
- List all ordersPOST /api/v1/orders/
- Create new orderGET /api/v1/orders/{id}/
- Get order detailsPUT /api/v1/orders/{id}/
- Update order status
GET /api/v1/reports/sales/
- Generate sales reportGET /api/v1/reports/low-stock/
- Generate low stock report
- JWT Authentication
- CORS configuration
- Request rate limiting
- Input validation and sanitization
- id (UUID)
- title (String)
- course_code (String)
- department (String)
- level (String)
- price (Decimal)
- stock (Integer)
- description (Text)
- created_at (DateTime)
- updated_at (DateTime)
- id (UUID)
- reference (String)
- student (ForeignKey)
- items (ManyToMany)
- total_amount (Decimal)
- status (String)
- created_at (DateTime)
- updated_at (DateTime)
- id (UUID)
- email (String)
- full_name (String)
- role (String)
- department (String)
- level (String)
coverage report
- Follow PEP 8 style guide
- Write tests for new features
- Update documentation when adding endpoints
- Use meaningful commit messages
- Create feature branches for new development
Common issues and solutions:
-
Database connection errors
- Check PostgreSQL service is running
- Verify database credentials in .env
-
Migration errors
- Delete migrations and recreate
- Reset database if in development
-
CORS issues
- Check CORS_ALLOWED_ORIGINS in settings
- Verify frontend origin
This project is licensed under the MIT License - see the LICENSE file for details