How zerrins/anverra-global works
Purpose and entry points
Anverra Global is an insurance-management system with a modular Java backend and two clients: a browser application and a mobile application. Backend startup is backend/src/main/java/com/anverraglobal/AnverraGlobalApplication.java; shared wiring and retry scheduling are in backend/src/main/java/com/anverraglobal/ApplicationConfiguration.java and backend/src/main/java/com/anverraglobal/EventRetryScheduler.java. Browser startup is frontend/src/main.tsx; mobile startup is mobile/index.ts and mobile/App.tsx.
Backend architecture and boundaries
The backend is a Maven-built modular monolith organized by business capability. Each primary module generally follows hexagonal boundaries: inbound web adapter → application service/contracts → domain model → outbound persistence port/adapter. Platform-wide HTTP error and security boundaries sit outside business modules in backend/src/main/java/com/anverraglobal/platform/api/GlobalExceptionHandler.java and backend/src/main/java/com/anverraglobal/platform/security/SecurityConfig.java.
Core insurance capabilities
The principal write-side modules are:
• Customer lifecycle and verification: backend/src/main/java/com/anverraglobal/customer/application/CustomerManagementApplicationService.java, backend/src/main/java/com/anverraglobal/customer/domain/Customer.java.
• Product lifecycle and verification: backend/src/main/java/com/anverraglobal/product/application/ProductManagementApplicationService.java, backend/src/main/java/com/anverraglobal/product/domain/Product.java.
• Insurer lifecycle and verification: backend/src/main/java/com/anverraglobal/insurer/application/InsurerManagementApplicationService.java, backend/src/main/java/com/anverraglobal/insurer/domain/Insurer.java.
• Policy management, lifecycle changes, premium updates, and document storage: backend/src/main/java/com/anverraglobal/policy/application/PolicyManagementApplicationService.java, backend/src/main/java/com/anverraglobal/policy/domain/Policy.java, backend/src/main/java/com/anverraglobal/policy/adapter/outbound/storage/CloudflareR2Adapter.java.
• Commission configuration and state: backend/src/main/java/com/anverraglobal/commission/application/CommissionManagementServiceImpl.java, backend/src/main/java/com/anverraglobal/commission/domain/Commission.java.
Identity, authorization, and organization scope
Requests are authenticated as JWT resource-server traffic; audience validation and claim-to-authority conversion are explicit integration points in backend/src/main/java/com/anverraglobal/identity/AudienceValidator.java and backend/src/main/java/com/anverraglobal/identity/CustomJwtAuthenticationConverter.java. Identity profiles are locally synchronized/persisted through backend/src/main/java/com/anverraglobal/identity/application/IdentityProfileService.java. Organization hierarchy and scope resolution control business visibility through backend/src/main/java/com/anverraglobal/organization/application/OrganizationHierarchyServiceImpl.java and backend/src/main/java/com/anverraglobal/organization/application/OrganizationScopeResolutionServiceImpl.java.
Events, reporting, and persistence flow
Policy lifecycle and premium changes publish explicit domain events, including backend/src/main/java/com/anverraglobal/policy/event/PolicyCreatedEvent.java and backend/src/main/java/com/anverraglobal/policy/event/PolicyPremiumUpdatedEvent.java; commission configuration has backend/src/main/java/com/anverraglobal/commission/event/CommissionConfiguredEvent.java. Reporting consumes these events to maintain a separate read model: backend/src/main/java/com/anverraglobal/reporting/application/ReportingEventConsumer.java and backend/src/main/java/com/anverraglobal/reporting/adapter/outbound/persistence/ReportingReadModelEntity.java. Failed event work is a scheduled concern via EventRetryScheduler. Relational schema evolution is managed with Flyway migrations under backend/src/main/resources/db/migration/V1__init.sql through V8__policy_product_dates_financials.sql.
Client/API integration
The React browser client provides authenticated, protected routing and management/reporting screens through frontend/src/routes/Router.tsx, frontend/src/auth/AuthProvider.tsx, and frontend/src/pages/ReportingDashboard.tsx. Its typed endpoint clients derive from the OpenAPI contract in frontend/openapi.json, with generated controller clients under frontend/src/api/endpoints/. The mobile client is a React Native application centered on authentication and policy workflows: mobile/src/auth/AuthContext.tsx, mobile/src/navigation/RootNavigator.tsx, and mobile/src/screens/PoliciesScreen.tsx; it uses generated API bindings in mobile/src/api/generated/endpoints.ts.
Material infrastructure and external services
Runtime infrastructure consists of the Java/Spring-style backend, a relational database accessed through repository/persistence adapters, and Flyway migrations. External identity is JWT/OIDC-style authentication, while policy documents integrate with Cloudflare R2 through CloudflareR2Adapter. Frontend and mobile clients consume the backend’s OpenAPI-described HTTP API and contain custom request mutators at frontend/src/api/mutator/custom-instance.ts and mobile/src/api/mutator/custom-instance.ts.
Main entry points: V1__init.sql Relational database · SecurityConfig.java JWT security boundary · PolicyManagementApplicationService.java Policy management · ReportingEventConsumer.java Reporting consumer
Components 19
Java backend
Modular monolith with hexagonal business modules.
- Backend bootstrap · Wires application services and scheduled retry work.
backend/src/main/java/com/anverraglobal/AnverraGlobalApplication.java - JWT security boundary · Validates audience and maps claims to authorities.
backend/src/main/java/com/anverraglobal/platform/security/SecurityConfig.java - Identity profiles · Synchronizes locally persisted identity profiles.
backend/src/main/java/com/anverraglobal/identity/application/IdentityProfileService.java - Organization scope · Resolves hierarchy and business visibility scope.
backend/src/main/java/com/anverraglobal/organization/application/OrganizationScopeResolutionServiceImpl.java - Customer management · Customer lifecycle and verification.
backend/src/main/java/com/anverraglobal/customer/application/CustomerManagementApplicationService.java - Product management · Product lifecycle and verification.
backend/src/main/java/com/anverraglobal/product/application/ProductManagementApplicationService.java - Insurer management · Insurer lifecycle and verification.
backend/src/main/java/com/anverraglobal/insurer/application/InsurerManagementApplicationService.java - Policy management · Manages policy lifecycle, premiums, and documents.
backend/src/main/java/com/anverraglobal/policy/application/PolicyManagementApplicationService.java - Commission management · Configures commission state and events.
backend/src/main/java/com/anverraglobal/commission/application/CommissionManagementServiceImpl.java - Reporting consumer · Projects domain events into a reporting read model.
backend/src/main/java/com/anverraglobal/reporting/application/ReportingEventConsumer.java - Reporting read model
backend/src/main/java/com/anverraglobal/reporting/adapter/outbound/persistence/ReportingReadModelEntity.java - Event retry scheduler · Retries failed event work.
backend/src/main/java/com/anverraglobal/EventRetryScheduler.java - Relational database · Schema is evolved through Flyway migrations.
backend/src/main/resources/db/migration/V1__init.sql - Cloudflare R2 · Stores policy documents.
backend/src/main/java/com/anverraglobal/policy/adapter/outbound/storage/CloudflareR2Adapter.java
Browser client
- React application · Protected management and reporting UI.
frontend/src/main.tsx - Typed API client · Generated controller clients use a custom request mutator.
Mobile client
- React Native application · Authentication and policy workflows.
mobile/App.tsx - Generated API bindings · Uses a custom request mutator.
mobile/src/api/generated/endpoints.ts
Other components
- OIDC identity provider · Issues JWT resource-server traffic.
Connections 20
- Backend bootstrap → JWT security boundary: configures
- JWT security boundary → OIDC identity provider: validates JWTs from
- JWT security boundary → Identity profiles: authenticated requests
- Identity profiles → Relational database: persists profiles
- Organization scope → Relational database: reads hierarchy
- Customer management → Relational database: persists
- Product management → Relational database: persists
- Insurer management → Relational database: persists
- Policy management → Organization scope: enforces scope
- Policy management → Relational database: persists
- Policy management → Cloudflare R2: stores documents
- Commission management → Relational database: persists
- Policy management → Reporting consumer: policy lifecycle events
- Commission management → Reporting consumer: commission configured event
- Reporting consumer → Reporting read model: updates projections
- Event retry scheduler → Reporting consumer: retries failed work
- React application → Typed API client: uses
- Typed API client → JWT security boundary: authenticated HTTP API
- React Native application → Generated API bindings: uses
- Generated API bindings → JWT security boundary: authenticated HTTP API