Backend API for the Coderr frontend (https://github.com/codebySaschaHeinze/coderr-frontend.git).
Provides token-based authentication, user profiles, offers (with package details), orders, reviews, and aggregated platform base info.
- Tech Stack
- Key Concepts
- API Base URL
- Authentication
- Endpoints
- Data Model (Relations)
- Project Structure
- Setup (Local Development)
- Python
- Django
- Django REST Framework (DRF)
- DRF Token Authentication
- django-cors-headers
- django-filter
- Pillow (image fields)
- SQLite (dev)
- Authentication via
Authorization: Token <token> - Custom user model (
auth_app.User) with role-based user types:customerbusiness
- Automatic profile creation on registration (
Profileis linked viaOneToOneField) - Offer structure:
- one
Offer - exactly 3
OfferDetailpackages (basic,standard,premium)
- one
- Orders are created by customers from an
offer_detail_id - Reviews are created by customers for business users (one review per customer/business pair)
- Public aggregated platform stats available via
/api/base-info/
http://127.0.0.1:8000/api/
-
This project uses DRF Token Authentication.
-
Header format (protected endpoints)
-
Authorization: Token <your_token>
- Request: username, email, password, repeated_password, type (customer or business)
- Response: token, user_id, username, email
- Notes: Creates a Profile automatically. Passwords must match.
- Request: username, password
- Response: token, user_id, username, email
- Auth required
- Read access for authenticated users
- Auth required (Only profile owner)
- Supports profile fields and nested user email update
- Auth required
- Returns profile list for users with type='business'
- Auth required
- Returns profile list for users with type='customer'
- Public offer list with filtering, search, and pagination
- Filters: creator_id, min_price, max_delivery_time
- Auth required (Only business users)
- Request: title, description, image, and exactly 3 details
- Auth required
- Returns offer with detail links and aggregated min values
- Auth required (Only owner)
- Supports nested updates for the 3 packages
- Auth required (Only owner)
- Auth required
- Returns orders where user is either customer or business provider
- Auth required (Only customers)
- Request: offer_detail_id
- Auth required (Only business users)
- Allowed field: status (in_progress, completed, cancelled)
- Auth required
- Returns count of in-progress orders
- Auth required
- Filtering: business_user_id, reviewer_id
- Auth required (Only customers)
- Request: business_user (ID), rating, description
- Auth required (Only owner)
- No auth required
- Response: review_count, average_rating, business_profile_count, offer_count
- User has one Profile (1:1)
- Business User creates many Offers (1:n)
- Offer has exactly 3 OfferDetails (1:3)
- Customer creates many Orders (1:n)
- Business receives many Orders (1:n)
- Customer writes many Reviews (1:n)
coderr-backend/
├─ core/ Django project (settings, root urls, wsgi/asgi)
│ ├─ __init__.py
│ ├─ settings.py
│ ├─ urls.py
│ ├─ asgi.py
│ └─ wsgi.py
│
├─ auth_app/ Custom user model + auth API
│ ├─ migrations/
│ ├─ tests/
│ │ ├─ test_happy.py
│ │ └─ test_unhappy.py
│ ├─ api/
│ │ ├─ serializers.py
│ │ ├─ urls.py
│ │ ├─ validators.py
│ │ └─ views.py
│ ├─ management/
│ │ └─ commands/
│ │ └─ seed_guest_users.py Guest demo users + profiles (custom command, if added)
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ profile_app/ Profile domain (detail + customer/business lists)
│ ├─ migrations/
│ ├─ tests/
│ │ ├─ test_happy.py
│ │ └─ test_unhappy.py
│ ├─ api/
│ │ ├─ permissions.py
│ │ ├─ serializers.py
│ │ ├─ urls.py
│ │ ├─ validators.py
│ │ └─ views.py
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ offers_app/ Offers + offer package details
│ ├─ migrations/
│ ├─ tests/
│ │ ├─ test_happy.py
│ │ └─ test_unhappy.py
│ ├─ api/
│ │ ├─ filters.py
│ │ ├─ pagination.py
│ │ ├─ permissions.py
│ │ ├─ serializers.py
│ │ ├─ urls.py
│ │ ├─ validators.py
│ │ └─ views.py
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ orders_app/ Orders domain
│ ├─ migrations/
│ ├─ tests/
│ │ ├─ test_happy.py
│ │ └─ test_unhappy.py
│ ├─ api/
│ │ ├─ permissions.py
│ │ ├─ serializers.py
│ │ ├─ urls.py
│ │ ├─ validators.py
│ │ └─ views.py
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ reviews_app/ Reviews domain
│ ├─ migrations/
│ ├─ tests/
│ │ ├─ test_happy.py
│ │ └─ test_unhappy.py
│ ├─ api/
│ │ ├─ filters.py
│ │ ├─ permissions.py
│ │ ├─ serializers.py
│ │ ├─ urls.py
│ │ ├─ validators.py
│ │ └─ views.py
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ baseinfo_app/ Public aggregated platform data
│ ├─ migrations/
│ ├─ tests/
│ │ └─ test_happy.py
│ ├─ api/
│ │ ├─ urls.py
│ │ └─ views.py
│ ├─ admin.py
│ ├─ apps.py
│ └─ models.py
│
├─ .env.template
├─ .gitignore
├─ manage.py
├─ README.md
└─ requirements.txt
Windows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1
macOS/Linux:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
If requirements.txt is not yet present:
pip install django djangorestframework django-cors-headers
pip install python-dotenv
pip freeze > requirements.txt
Create a .env file (use .env.template as reference)
The project loads .env via python-dotenv in core/settings.py
SECRET_KEY='add_your_secret_key_here'
DEBUG=1
python manage.py migrate
python manage.py seed_all
python manage.py runserver
For all protected endpoints send:
Authorization: Token <your_token>
This project is intended for local development and learning.
Do not use the Django development server in production.
For production, use a proper WSGI/ASGI server and a production database.
Educational / internal project (adjust as needed).