Athena — claimio/architecture.md

Claimio — Architecture

Claimio is a B2B SaaS sold to insurers and car-rental companies: a white-label native Flutter app + Spring Boot backend that guides claimants through a structured Dutch schadeformulier (damage-claim form). Fraud is reduced through structured intake, cryptographically signed photos (via AuditPic), and a full audit trail.

Owner: Mahmoud Consultancy B.V. · Builder: GloryLabs · Repo: mahmoudholding/claimio Ports (workspace registry): backend 8094, PostgreSQL 5437, Redis 6380, AuditPic (external) 8093.


System components

┌──────────────────────────────────────────────────────────────┐
│  Flutter app (white-label, per-tenant branding) — iOS/Android  │
└───────────────────────────┬────────────────────────────────────┘
                            │ HTTPS / JWT
                            ▼
┌──────────────────────────────────────────────────────────────┐
│  Spring Boot backend  :8094                                    │
│   Auth · Claim · Tenant · Retention (scheduled)                │
│         │            │            │                            │
│   ┌─────▼────────────▼────────────▼─────────────────────────┐  │
│   │  PostgreSQL :5437   (Flyway migrations)                  │  │
│   ├──────────────────────────────────────────────────────────┤  │
│   │  Redis :6380        (rate limiting via Bucket4j)         │  │
│   └──────────────────────────────────────────────────────────┘  │
└───────────────────────────┬────────────────────────────────────┘
                            │ REST + API key
                            ▼
┌──────────────────────────────────────────────────────────────┐
│  AuditPic microservice  :8093                                  │
│  SHA-256 + HMAC-SHA256 photo signing · Hive AI deepfake check  │
└──────────────────────────────────────────────────────────────┘

There is no Angular/web frontend — the client is a native Flutter app. The backend is the only HTTP service Claimio operates; AuditPic is a separate Mahmoud Consultancy product consumed over REST with an API key.


Tech stack

| Layer | Technology | |-------|-----------| | Mobile | Flutter 3.8+, Dart 3.7+ (Riverpod, go_router), white-label theming | | Backend | Spring Boot 3, Java 21, Maven (Spring Boot 4 / Java 25 migration tracked — claimio#53) | | Database | PostgreSQL (Flyway migrations) | | Cache | Redis (Bucket4j rate limiting) | | Auth | JWT (jjwt 0.12.6), self-issued, with rotation overlap | | Photo integrity | AuditPic (SHA-256 + HMAC-SHA256) | | Infra | k3s (single-node, TransIP 136.144.174.219), Helm chart at k8s/, Bitnami Sealed Secrets | | Registry | ghcr.io/mahmoudholding/claimio/backend |


Layered backend architecture

Controller  →  Service  →  Repository
    ↑              ↑
  DTOs          Entities (JPA)
  • Controllers validate input (@Validated + Bean Validation), map to/from DTOs, and enforce method security (@PreAuthorize).
  • Services hold business logic; entities never cross the API boundary.
  • Repositories are Spring Data JPA interfaces.

Multi-tenancy & white-label

Every insurer / car-rental company is a Tenant; all data is tenant-scoped.

| Mechanism | Detail | |-----------|--------| | Tenant resolution | X-Tenant-ID header (set by the Flutter app / gateway) | | Storage | tenant_id column on every data table | | Branding | GET /api/v1/tenants/{id}/config → Flutter builds ThemeData (name, logo, primary/secondary colour, contact) | | Retention | Per-tenant claim_retention_days, default 7 years (2557 days) |


Security architecture

AuthN / AuthZ

  • JWT (HS256): 24h access + 30-day refresh; JWT_PREVIOUS_SECRET enables zero-downtime key rotation.
  • Roles CLAIMANT, REVIEWER, ADMIN, enforced via method security across all controllers.
  • Bucket4j + Redis rate limiting (e.g. 5 req/min login, 10 req/min claim POST per IP).

PII protection

| Layer | Control | |-------|---------| | At rest | AES-256-GCM per-field encryption (EncryptedStringConverter) on all PII columns | | Email lookup | HMAC-SHA256 blind index (EmailHashService) | | In logs | PiiMaskingConverter scrubs emails, IBANs, Dutch licence plates, BSN | | In transit | TLS via cert-manager (Let's Encrypt) on ingress | | Retention | Nightly DataRetentionService anonymises claims past their cutoff |

Database users (two-role model)

| User | Privileges | Used by | |------|-----------|---------| | claimio_app | DML only (SELECT/INSERT/UPDATE/DELETE) | Runtime app | | claimio (admin) | DDL — schema owner | Flyway migrations only |

The runtime CREATEROLE grant for the two-user split is one of the cluster bring-up quirks — see deployment.md and the staging recipe.


Photo integrity (AuditPic integration)

  1. Flutter captures a photo and computes SHA-256 client-side.
  2. Backend uploads photo + hash to AuditPic via AuditPicClient.
  3. AuditPic signs with HMAC-SHA256 and runs Hive AI deepfake detection.
  4. Backend stores the returned verification_id.
  5. Any post-submission edit produces a signature mismatch — tampering is detectable.

Infrastructure

| Component | Detail | |-----------|--------| | VPS | TransIP 136.144.174.219, Debian 13 | | Orchestration | k3s (single-node) | | Namespaces | claimio (prod), claimio-staging (staging) | | Secrets | 1Password (Claimio vault) → Sealed Secrets → k3s | | Backups | Nightly pg_dump → gzip → GPG AES-256 → S3 CronJob, 90-day retention | | CI/CD | GitHub Actions → GHCR → helm upgrade |

See deployment.md for the deploy flow and cluster runbooks, setup.md for local dev + secrets, and compliance/ for DPIA / NIS2 / BIO / BC-DR / verwerkingsregister.

The canonical, repo-relative versions of these docs also live in the claimio repo at docs/claimio/. This workspace copy is the cross-project (Mahmoud Consultancy) view. api.md is intentionally deferred while the Claim model is mid-change under claimio#94.

Reacties

Nog geen reacties