- type
- moc
- created
- Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
- updated
- Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
- tags
- moc architecture technical
MOC: Architecture
abstract
Map of Content for the technical architecture of B2BPaper. Django REST backend + Angular 19 frontend, PostgreSQL, Celery, Redis, deployed via PM2 + nginx on Contabo VPS.Stack at a Glance
| Layer | Tech | Notes |
|---|---|---|
| Backend | Django 6.0.2 + DRF | backend/, port 8910 via gunicorn |
| Frontend | Angular 19 standalone | frontend/, built to /var/www/hub/b2bpaper-app/ |
| Database | PostgreSQL | name: b2bpaper, integer cents for prices |
| Async | Celery + Redis | Excel polling, matching, newsletter generation (5min beat) |
| Auth | JWT | role-based: mill / buyer / admin |
| Tests | pytest + Playwright | 741 passing |
See wiki/wiki/concepts/django-app-layout and wiki/wiki/concepts/angular-frontend-stack.
The 4-Layer Architecture
wiki/wiki/concepts/four-layer-architecture
- Data Bootstrap — seeding, fixtures, master product catalog.
- Entity — core models (Products, Surplus, Mills, Buyers, etc.).
- Action — business operations (matching, exclusivity, newsletter).
- Output — APIs, emails, dashboards, exports.
The 6 Core Entities
wiki/wiki/concepts/six-core-entities
- Products (master catalog)
- Surplus Availability
- Mills
- Mills Surplus Visibility (regional config)
- Buyers
- Buyer Specifics (stored requirements for matching)
The 8 Core Actions
wiki/wiki/concepts/eight-core-actions
- Extract Buyers
- Extract Mills
- Exclusivity (48h window)
- Pre-Production Announcements
- Newsletter Generation
- Container Assembly
- Excel Ingestion
- Visibility Configuration
Key Patterns
- wiki/wiki/concepts/service-layer-pattern — pure-function
services.pyper Django app - wiki/wiki/concepts/excel-ingestion-pipeline — file_processor → parser → validator → pipeline
- wiki/wiki/concepts/matching-algorithm — 5 scoring functions + composite
- wiki/wiki/concepts/container-fill-optimization — paper group + grade proximity scoring
Frontend
wiki/wiki/concepts/angular-frontend-stack — standalone components, OnPush, inject(), @if/@for, Reactive Forms, Tailwind tokens (no raw hex).
Conventions
- Prices as integer cents, never floats
- No
__all__in serializers — always explicit fields - API prefix:
/api/v1/ - See wiki/wiki/summaries/codeguidelines-summary for full standards
Source Summaries
- wiki/wiki/summaries/systempatterns-summary — 4-layer model and core entities
- wiki/wiki/summaries/techcontext-summary — tech stack and infrastructure
- wiki/wiki/summaries/frontend-spec-summary — Angular component specs
- wiki/wiki/summaries/codeguidelines-summary — coding standards
- wiki/wiki/summaries/prd-summary — full PRD with technical details
Related MOCs
- wiki/wiki/_moc-operations — how the architecture is deployed and run
- wiki/wiki/_moc-product — what the architecture serves