============================================================
Architecture: Traditional SaaS (single PostgreSQL database, row-level access control via
roleandvisibilitycolumns).
Reference app: GP Booking App (patterns: Django 5.2, DRF, gunicorn, celery, mozilla-django-oidc, grappelli, docker-compose).
Key difference from GP Booking App: No SiaaS multi-tenancy (noTenantMiddleware, noSectorDatabaseRouter, no per-client databases). Single Keycloak realmixg.
ixg-green: #1A3D2B
ixg-gold: #B07D0E
ixg-light: #F7F6F2
ixg-dark: #1A1A1A
Objective: Django project scaffold, Docker environment, PostgreSQL database schema, authentication.
/root/work/ixg_platform/docker-compose.yml: app (gunicorn), celery_worker, celery_beat, postgres:15-alpine, redis:7-alpineDockerfile: python:3.11-slimscripts/entrypoint.sh: wait-for-db → migrate → collectstatic → gunicorn/etc/nginx/sites-enabled/ixg| # | Model | Table | App |
|---|---|---|---|
| 1 | User | users | users |
| 2 | Subscription | subscriptions | subscriptions |
| 3 | ProcessingBatch | processing_batches | batches |
| 4 | QCResult | qc_results | qc |
| 5 | CertificateOfAnalysis | certificates_of_analysis | documents |
| 6 | RegulatoryCert | regulatory_certs | documents |
| 7 | Shipment | shipments | shipments |
| 8 | Document | documents | documents |
| 9 | CAPARecord | capa_records | capa |
| 10 | ESGFieldReport | esg_field_reports | esg |
| 11 | AIInteraction | ai_interactions | ai |
| 12 | Notification | notifications | notifications |
| 13 | AgentConfig | agent_configs | ai |
mozilla-django-oidc with custom KeycloakOIDCBackendixg at http://194.164.95.50:8443/admin/ai/agentconfig/Objective: CRUD APIs for all business entities.
GET/POST/PUT/DELETE /api/batches/GET/POST/PUT/DELETE /api/qc-results/GET/POST/PUT/DELETE /api/shipments/POST /api/documents/upload/ — file upload with type/visibilityGET /api/documents/ — list with buyer visibility filtering/data/ixg-documents/{batch_id}/{filename}GET/POST/PUT/DELETE /api/capa-records/GET/POST/PUT/DELETE /api/esg-reports/Objective: Operations dashboard and management interface at /ops/.
Templates: 11 templates in templates/ops/ (base_ops.html + 10 pages)
Objective: Buyer-facing dashboard and management interface at /portal/.
Objective: AI chatbot, agent management, chat UI.
AgentService.execute_prompt()POST /api/ai-interactions/chat/ — accepts agent_id, message, session_id, history/admin/ai/agentconfig/ for creating/configuring agents/portal/chat/ — agent selector, session management, Markdown rendering/portal/chat/embed/ — iframe-ready with ?agent_id=XChat UI: Chat API works with token auth; browser session cookie auth needs debugging for the chat page JS fetch.
Email notifications: SMTP outgoing (QC fail alerts, shipment updates, CAPA assignments) + IMAP incoming (certificate PDF auto-import). Requires domain + email hosting (Fasthosts like GP Booking App) or transactional API (SendGrid/Mailgun).
Compliance automation: ✅ implemented (P99C, deployed 05 Aug 2026).
Polish: UI refinement, form validation, error handling, loading states across both portals.
| Aspect | GP Booking App (SiaaS) | IXG Platform (SaaS) |
|---|---|---|
| Database | Multi-DB per client | Single PostgreSQL |
| Tenancy | Subdomain-based TenantMiddleware | Role/visibility row-level |
| Auth | Multi-realm Keycloak | Single ixg realm |
| User model | CustomUser (AbstractUser) | User (AbstractUser) |
| Auth backend | OIDC + CrossClient | OIDC + ModelBackend |
| File storage | Per-client | Central /data/ixg-documents/ |
| Encryption | django-encrypted-model-fields | Same (API keys, email creds) |
| AI agents | integrations_agentconfig | ai.AgentConfig (same pattern) |
| Frontend | Django templates + DRF | Django templates + DRF |
/root/work/ixg_platform/SESSION_CHECKPOINT.md (on VPS)/root/work/ixg_platform/ (on VPS)============================================================