System Architecture

evergreenLast update on Sep 1, 2026
Download .md

System Architecture

Target Modules

ModuleResponsibility
BackendAPI, domain rules, auth enforcement, persistence, event ingest
WebDashboard, admin operations, review/approval workflows
MobileReceiving, tagging, offline capture, field workflows
ContractsOpenAPI schema and generated API clients
InfrastructureDatabase, local services, deployment packaging

Dependency Direction

flowchart TD
    Contract["OpenAPI contract"] --> Backend["Spring interfaces and DTOs"]
    Contract --> WebClient["Generated TypeScript client"]
    Contract --> MobileClient["Generated Dart client"]
    Backend --> DB[(PostgreSQL)]
    Web["Next.js app"] --> WebClient
    Mobile["Flutter app"] --> MobileClient

Backend Boundary

  • Backend owns authorization, transactions, migrations, and data integrity.
  • API DTOs are not JPA entities.
  • Write operations validate input at API and domain boundaries.
  • Sensitive operations create audit events.

Web Boundary

  • Web stores session material in HttpOnly, Secure cookies.
  • Web uses the generated TypeScript client through one wrapper.
  • Hiding UI controls is not authorization; backend still enforces permissions.

Mobile Boundary

  • Mobile stores refresh credentials in platform secure storage.
  • Mobile sends access tokens through Authorization: Bearer.
  • Offline behavior must be explicit for each workflow.
  • Retryable writes must be idempotent.

Configuration

EnvironmentRule
LocalApps run natively; shared services run through Docker Compose
TestIsolated services; backend integration tests use Testcontainers
StagingProduction-like secrets, migrations, and smoke tests
ProductionManaged secrets, TLS, monitoring, controlled rollout