# ruyanga/ist-technical-assessment-be architecture

> Architecture diagram of the GitHub repository ruyanga/ist-technical-assessment-be, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ruyanga/ist-technical-assessment-be
- Repository: https://github.com/ruyanga/ist-technical-assessment-be

## Overview

Merci is a Django REST backend for frontend-driven JWT authentication, user management, and purchase workflows. A staff member submits a purchase request with items; role-based approvers review it, and approval can produce a purchase order. Users can submit and inspect receipts, while document endpoints support proforma extraction and receipt validation. The graph separates account access, request and approval handling, purchasing, and receipt/document work. Some capabilities are documented or indexed but their full implementations were not sampled, so only evidenced relationships are drawn.

Main entry points: [`core/purches/views/purchase_request_core.py`](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/purchase_request_core.py) (Request API), [`core/purches/services.py`](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/services.py) (Approval workflow service), [`core/purches/models/purchase_request.py`](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/models/purchase_request.py) (Purchase domain models), [`core/purches/po.py`](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/po.py) (Purchase order generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_accounts["Accounts &amp; access"]
  node_auth["JWT authentication<br/>[auth_views.py]"]
  node_auth_serializer["Email auth serializer"]
  node_user_management["User management<br/>[views.py]"]
end

subgraph group_requests["Requests &amp; approvals"]
  node_purchase_routes["Purchase API routes<br/>[urls.py]"]
  node_request_api["Request API"]
  node_request_serializer["Request serializer"]
  node_approval_api["Approval endpoints<br/>[approvals.py]"]
  node_approval_serializer["Approval serializer<br/>[approval.py]"]
  node_approval_service["Approval workflow service<br/>[services.py]"]
end

subgraph group_purchasing["Purchase orders"]
  node_purchase_models["Purchase domain models"]
  node_po_generator["Purchase order generation<br/>[po.py]"]
  node_po_api["Purchase order API<br/>[purchase_order.py]"]
  node_po_serializer["Purchase order serializer<br/>[purchase_order.py]"]
end

subgraph group_receipts["Receipts &amp; documents"]
  node_receipt_api["Receipt endpoints"]
  node_receipt_serializer["Receipt serializer<br/>[receipt.py]"]
  node_document_api["Document endpoints<br/>[documents.py]"]
  node_document_service["Document processing<br/>[services.py]"]
end

node_frontend(("Frontend client"))
node_database[("Application database<br/>[settings.py]")]
node_email["Email delivery"]

node_frontend -->|"requests tokens"| node_auth
node_auth -->|"validates credentials"| node_auth_serializer
node_frontend -->|"uses account APIs"| node_user_management
node_user_management -.->|"sends verification"| node_email
node_frontend -->|"calls purchase API"| node_purchase_routes
node_purchase_routes -->|"routes requests"| node_request_api
node_request_api -->|"serializes requests"| node_request_serializer
node_request_serializer -->|"creates request items"| node_purchase_models
node_request_api -->|"invokes approval"| node_approval_service
node_approval_api -->|"uses serializer"| node_approval_serializer
node_approval_api -->|"reads purchase state"| node_purchase_models
node_approval_service -->|"updates approvals"| node_purchase_models
node_approval_service -->|"creates purchase order"| node_po_generator
node_po_generator -->|"reads request data"| node_purchase_models
node_po_api -->|"serializes orders"| node_po_serializer
node_receipt_api -->|"serializes receipts"| node_receipt_serializer
node_document_api -->|"uses processing service"| node_document_service
node_document_service -->|"creates extracted order"| node_po_generator
node_request_api -.->|"reads and writes"| node_database
node_approval_service -.->|"persists decisions"| node_database
node_receipt_api -->|"reads receipts"| node_database

click node_auth "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/auth_views.py"
click node_auth_serializer "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/auth_serializers.py"
click node_user_management "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/views.py"
click node_purchase_routes "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/urls.py"
click node_request_api "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/purchase_request_core.py"
click node_request_serializer "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/purchase_request.py"
click node_approval_api "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/approvals.py"
click node_approval_serializer "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/approval.py"
click node_approval_service "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/services.py"
click node_purchase_models "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/models/purchase_request.py"
click node_po_generator "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/po.py"
click node_po_api "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/purchase_order.py"
click node_po_serializer "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/purchase_order.py"
click node_receipt_api "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/approvals_receipts.py"
click node_receipt_serializer "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/receipt.py"
click node_document_api "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/documents.py"
click node_document_service "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/services.py"
click node_database "https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/settings.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth,node_auth_serializer,node_user_management,node_frontend toneBlue
class node_purchase_routes,node_request_api,node_request_serializer,node_approval_api,node_approval_serializer,node_approval_service,node_database toneAmber
class node_purchase_models,node_po_generator,node_po_api,node_po_serializer toneMint
class node_receipt_api,node_receipt_serializer,node_document_api,node_document_service toneRose
class node_email toneIndigo
```

## Components

### Accounts & access

- [JWT authentication](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/auth_views.py): `core/users/auth_views.py`
- [Email auth serializer](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/auth_serializers.py): `core/users/auth_serializers.py`
- [User management](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/users/views.py): `core/users/views.py`

### Requests & approvals

- [Purchase API routes](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/urls.py): `core/purches/urls.py`
- [Request API](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/purchase_request_core.py): `core/purches/views/purchase_request_core.py`
- [Request serializer](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/purchase_request.py): `core/purches/serializers/purchase_request.py`
- [Approval endpoints](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/approvals.py): `core/purches/views/approvals.py`
- [Approval serializer](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/approval.py): `core/purches/serializers/approval.py`
- [Approval workflow service](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/services.py): `core/purches/services.py`

### Purchase orders

- [Purchase domain models](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/models/purchase_request.py): `core/purches/models/purchase_request.py`
- [Purchase order generation](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/po.py): `core/purches/po.py`
- [Purchase order API](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/purchase_order.py): `core/purches/views/purchase_order.py`
- [Purchase order serializer](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/purchase_order.py): `core/purches/serializers/purchase_order.py`

### Receipts & documents

- [Receipt endpoints](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/approvals_receipts.py): `core/purches/views/approvals_receipts.py`
- [Receipt serializer](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/serializers/receipt.py): `core/purches/serializers/receipt.py`
- [Document endpoints](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/views/documents.py): `core/purches/views/documents.py`
- [Document processing](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/purches/services.py): `core/purches/services.py`

### Other components

- **Frontend client**
- [Application database](https://github.com/ruyanga/ist-technical-assessment-be/blob/main/core/settings.py): `core/settings.py`
- **Email delivery**

## Connections

- Frontend client → JWT authentication: requests tokens
- JWT authentication → Email auth serializer: validates credentials (evidence: `core/users/auth_views.py`)
- Frontend client → User management: uses account APIs
- User management → Email delivery: sends verification (evidence: `core/users/views.py`)
- Frontend client → Purchase API routes: calls purchase API
- Purchase API routes → Request API: routes requests (evidence: `core/purches/urls.py`)
- Request API → Request serializer: serializes requests (evidence: `core/purches/views/purchase_request_core.py`)
- Request serializer → Purchase domain models: creates request items (evidence: `core/purches/serializers/purchase_request.py`)
- Request API → Approval workflow service: invokes approval (evidence: `core/purches/views/purchase_request_core.py`)
- Approval endpoints → Approval serializer: uses serializer (evidence: `core/purches/views/approvals.py`)
- Approval endpoints → Purchase domain models: reads purchase state (evidence: `core/purches/views/approvals.py`)
- Approval workflow service → Purchase domain models: updates approvals (evidence: `core/purches/services.py`)
- Approval workflow service → Purchase order generation: creates purchase order (evidence: `core/purches/services.py`)
- Purchase order generation → Purchase domain models: reads request data (evidence: `core/purches/po.py`)
- Purchase order API → Purchase order serializer: serializes orders (evidence: `core/purches/views/purchase_order.py`)
- Receipt endpoints → Receipt serializer: serializes receipts (evidence: `core/purches/views/approvals_receipts.py`)
- Document endpoints → Document processing: uses processing service (evidence: `core/purches/views/documents.py`)
- Document processing → Purchase order generation: creates extracted order (evidence: `core/purches/services.py`)
- Request API → Application database: reads and writes
- Approval workflow service → Application database: persists decisions
- Receipt endpoints → Application database: reads receipts (evidence: `core/purches/views/approvals_receipts.py`)
