Django REST Framework + PostgreSQL backend for: https://roadmap.sh/projects/image-processing-service
Foundation milestone: PostgreSQL configuration, registration, JWT login/refresh/logout, and protected profile endpoint. Image APIs, worker queue, frontend, and deployment are planned, not implemented. This is not yet a complete roadmap.sh submission. Files received a Python syntax check only; dependency installation was blocked in the creation environment, so Django checks and tests must still be run locally.
Requires Python 3.12+ and a running PostgreSQL server.
cd image-processing-service
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
Copy-Item .env.example .env
python -c "import secrets; print(secrets.token_urlsafe(64))"Paste the generated value into DJANGO_SECRET_KEY in .env. Set PostgreSQL credentials.
Do not commit .env. If PowerShell prevents activation, invoke
.\.venv\Scripts\python.exe in place of python without changing execution policy.
In PostgreSQL's SQL Shell (psql), as a database administrator:
CREATE ROLE image_service WITH LOGIN PASSWORD 'choose-your-own-password';
CREATE DATABASE image_service OWNER image_service;Set POSTGRES_PASSWORD to that password. Then:
python manage.py migrate
python manage.py check
python manage.py runserverLinux/macOS: use python3 -m venv .venv, source .venv/bin/activate, and
cp .env.example .env; other Python commands are the same.
$body = @{username='surbhi'; email='you@example.com'; password='Your-own-strong-password'} | ConvertTo-Json
$auth = Invoke-RestMethod -Method Post -Uri 'http://127.0.0.1:8000/api/v1/auth/register/' -ContentType 'application/json' -Body $body
Invoke-RestMethod -Uri 'http://127.0.0.1:8000/api/v1/auth/me/' -Headers @{Authorization="Bearer $($auth.access)"}POST /api/v1/auth/login/: JSON username and password; returns access and refresh.
POST /api/v1/auth/refresh/: JSON refresh; returns rotated refresh and new access.
POST /api/v1/auth/logout/: JSON refresh; blacklists that refresh token.
Access tokens already issued remain valid for up to 15 minutes after logout.
GET /api/v1/auth/me/: requires Authorization: Bearer .
Usernames are unique; email is required but is not a login identifier or unique.
Use a dedicated local development database role. Django needs permission to create
its temporary test database: an administrator can run ALTER ROLE image_service CREATEDB;
for this local role. Never grant this to the deployed app role.
python manage.py test- Verify this foundation locally against PostgreSQL.
- Add owner-scoped images, upload validation, metadata, pagination and private downloads.
- Add Pillow transformations: resize, crop, rotate, watermark, flip/mirror, compression, JPEG/PNG/WebP conversion and filters; preserve originals.
- Add Celery + Redis with persistent job status, failure handling and retry semantics.
- Add dashboard: gallery, preview, transformation controls and job progress.
- Add private object storage, quotas, shared rate limits, deployment and CI tests.
- Record measured performance and screenshots; publish public GitHub repository and submit its URL to roadmap.sh.
This configuration is for local development. Before deployment configure HTTPS,
allowed hosts, a production server, shared throttling cache, private storage,
secret management, backups and monitoring. Run python manage.py check --deploy
with deployment settings. Default DRF throttling here uses process-local cache and
is not a strict production abuse-control mechanism. Keep image bytes outside
PostgreSQL; the database will store ownership, metadata and processing jobs.