Prism Copilot is a Django REST Framework backend for AI-assisted visual diagnostics, ML dataset management, and maintenance workflows. It combines authenticated APIs, asynchronous processing, cloud adapter boundaries, and a small ML operations surface for uploading datasets, registering models, and running inference jobs.
This repository demonstrates backend engineering work around API design, Django architecture, background processing, cloud integration boundaries, and testable service structure. It is not a generic Django starter template.
- Token-based authentication with a custom email-first user model.
- Django REST Framework APIs for health checks, user workflows, ML datasets, model records, inference jobs, and chatbot interactions.
- Celery and Redis integration for asynchronous and scheduled work.
- PostgreSQL-backed persistence with Django migrations.
- Cloud adapter layer for local and Azure-backed storage, search, ML endpoints, and OpenAI-compatible model calls.
- drf-spectacular OpenAPI schema and Swagger UI in development.
- Structured logging, request tracing, security headers, throttling, and production-oriented settings.
- Pytest coverage for authentication, user profile behavior, and core API endpoints.
- GitHub Actions workflow that runs the Django test suite against PostgreSQL and Redis.
- Python 3.13
- Django 5
- Django REST Framework
- PostgreSQL
- Redis
- Celery and django-celery-beat
- Knox authentication
- drf-spectacular
- Poetry
- Docker dev container
- Azure SDKs and OpenAI-compatible integrations
- Pytest and pytest-django
The project is organized as a modular Django backend:
conf/contains Django settings, URL routing, ASGI/WSGI entry points, Celery setup, and test settings.apps/users/owns authentication, token login/logout, profile APIs, user serializers, and throttling.apps/core/contains shared endpoints, middleware, logging helpers, and reusable task classes.apps/ml_ops/owns dataset, model, inference, and chatbot API resources.apps/cloud_adapters/provides the boundary between application code and cloud-specific providers.test_images/contains small demo fixtures for visual-analysis workflows.
More detail is available in docs/architecture.md.
The project is primarily an API backend. A browser demo is available through:
- Swagger UI:
http://localhost:8000/api/schema/swagger-ui/ - Django admin:
http://localhost:8000/admin-panel/ - Landing page:
http://localhost:8000/
Generated media and uploaded dataset artifacts are intentionally excluded from version control. Use test_images/ only as local demo fixtures.
- Python 3.13
- Poetry 1.8+
- PostgreSQL
- Redis
poetry installcp .env.example .envUpdate at least:
DJANGO_SECRET_KEYDATABASE_URLREDIS_URLCELERY_BROKER_URLCELERY_RESULT_BACKEND
Cloud variables such as Azure Search, Azure ML, and Azure OpenAI can remain empty when using local-only development paths.
poetry run python manage.py migratepoetry run python manage.py runserverThe API will be available at http://localhost:8000.
This repository includes a VS Code dev container under .devcontainer/.
docker compose -f .devcontainer/docker-compose.yml up --buildThe dev container starts PostgreSQL, Redis, and an application container that can run Django commands inside the workspace.
poetry run pytestWith coverage:
poetry run pytest --covThe GitHub Actions workflow in .github/workflows/test.yml runs the test suite with PostgreSQL and Redis services.
Development schema endpoints:
- OpenAPI schema:
/api/schema/ - Swagger UI:
/api/schema/swagger-ui/
Main API groups:
auth/- user creation, login, logout, token revocation, profilecore/- health checks and task examplesapi/ml/- datasets, ML models, inference, chatbot resources
See docs/api.md for endpoint groups and authentication notes.
Production deployment should provide PostgreSQL, Redis, object storage, and secure environment variables. Run migrations before release and keep generated media outside the repository.
See docs/deployment.md.
- Designing a modular Django/DRF backend with clear app boundaries.
- Using Celery and Redis for asynchronous processing.
- Building API documentation through OpenAPI tooling.
- Separating cloud integrations behind adapter modules.
- Writing backend tests for authentication and API behavior.
- Preparing a backend service for CI and containerized development.
- Add a production Dockerfile alongside the existing dev container.
- Expand tests around
apps/ml_opsviewsets and cloud adapter fallbacks. - Add object-storage lifecycle policies for inference artifacts.
- Add example API requests for the ML dataset and inference workflows.
- Replace the temporary landing page with a project-specific API landing page.
Do not commit real .env files, uploaded media, cloud credentials, dataset dumps, or generated inference output. Use .env.example for configuration documentation and rotate any exposed secret immediately.
See SECURITY.md.