Skip to content

Packages Overview

All packages live in packages/ and are published under the @openinsure/* scope. They are internal workspace packages — not published to npm. Reference them in other packages with "@openinsure/policy": "workspace:*".


Shared TypeScript types and enums used across all packages and apps. Import types from here rather than re-declaring in individual packages.

Key exports: PolicyStatus, ClaimStatus, LineOfBusiness, UserRole, NotificationChannel, InstallmentPlan


Database schema definitions (Drizzle ORM), migration utilities, and shared query helpers for PlanetScale (Vitess 22.0) via Hyperdrive.

Key exports: All Drizzle table objects (policies, claims, submissions, notifications, communicationsLedger, …), createDb(), migration CLI

Schema location: packages/db/src/supabase/schema/ Migrations: packages/db/migrations/supabase/ (0000–0081)


Shared runtime configuration, environment variable schemas (Zod), and feature flags.

Key exports: parseEnv(), getFeatureFlag(), feature flag constants


Authentication helpers, JWT utilities, and role definitions. Not the auth Worker (that’s apps/auth) — this package provides the middleware primitives.

Key exports: createJWT(), verifyJWT(), ROLES, requireRole() (used in API middleware)


Policy lifecycle state machine, transition validation, endorsement logic, cancellation, and renewal.

Key exports: validateTransition(), VALID_TRANSITIONS, calcReturnPremium(), PolicyStateMachine

Docs: Policy Lifecycle


Claims lifecycle management, reserve calculations, IBNR modeling, subrogation tracking, and litigation workflow.

Key exports: createClaim(), updateReserve(), calcIBNR(), ClaimStateMachine, reserve adequacy flags

Docs: Claims Management


Premium billing, installment plans, invoice generation, commission accounting, and trust ledger management.

Key exports: createInstallmentPlan(), calcReturnPremium(), calcCommission(), generateInvoice(), calcProRataRefund()

Docs: Premium Billing


Deterministic actuarial rating engine — factor waterfall, rate table lookups, schedule rating, experience modification.

Key exports: rateSubmission(), explainRating(), applyScheduleRating(), RatingInput, RatingAudit

Docs: Rating Engine


Underwriting rules engine, authority matrix enforcement, referral triggers, and DA validation.

Key exports: evaluateRules(), validateBindingAuthority(), checkAuthorityMatrix(), UWRule

Docs: Rating Engine & Underwriting


Producer / agency management — license tracking, appointment management, commission rates, and performance metrics.

Key exports: createProducer(), updateLicense(), calcProducerCommission(), validateAppointment()


Certificate of Insurance generation (ACORD 25) with additional insured logic, holder-specific conditions, batch issuance, and XSS-safe HTML rendering.

Key exports: buildCOIHTML(), generateCertificateNumber(), validateCOIRequest(), batchIssueCOIs(), COIRequest

Docs: Certificates of Insurance


Delegated authority agreement management, authority matrix configuration, breach detection, and aggregate tracking.

Key exports: validateBindingAuthority(), checkAggregateLimits(), recordBreach(), DAMatrix

Docs: Delegated Authority


Quota share, XOL, and aggregate XL treaty management, cession calculations, and cession statements.

Key exports: calcQuotaShareCession(), calcXOLCession(), calcAggregateXLCession(), compileCessionStatement()

Docs: Reinsurance Management


Specific and aggregate stop-loss calculations, premium estimation, and fund ratio analysis for captives.

Key exports: calcSpecificStopLoss(), calcAggregateStopLoss(), estimateSpecificSLPremium(), buildStopLossSummary()

Docs: Stop-Loss Insurance


Captive insurance administration — single-parent captive, group captive, and PCC management. Solvency monitoring and captive board reporting.

Key exports: calcFundedRatio(), runSolvencyCheck(), buildCaptiveReport()

Docs: Captive Overview


Loss run request workflows, PDF/CSV extraction, 5-year loss analysis, trend detection, and risk flagging.

Key exports: extractFromCSV(), extractFromPDF(), analyzeLossRun(), generateLossRun()

Docs: Loss Runs


Regulatory compliance engine — state filing requirements, notice periods, SLSF rates, surplus lines rules, and filing deadline tracking.

Key exports: validateCancellationDate(), getNoticePeriod(), calcSLSFTax(), getFilingRequirements()

Docs: Compliance Portal


State domicile rules for captives and RRGs — formation requirements, minimum capital, annual fees, and LRRA compliance.

Key exports: getDomicileRules(), validateCaptiveFormation(), getMinimumCapital(), LRRARequirements

Docs: Domicile Guide


HIPAA compliance utilities — PHI field taxonomy, audit logging, runtime redaction, and BAA tracking.

Key exports: redactPHI(), logPHIAccess(), PHI_FIELDS, validateBAA()

Docs: HIPAA Compliance


ACORD standard form data models and AI-powered extraction pipeline for ACORD 125, 200, and supplemental forms.

Key exports: ACORD125, ACORD200, extractFromPDF(), extractionConfidence

Docs: ACORD Form Extraction


X12 EDI transaction parser and builder — 834, 835, 837P, 210, 211.

Key exports: parseX12(), parse834(), parse835(), build837P(), parse210(), parse211()

Docs: X12 EDI


FHIR R4 resource builders and serializers for health data interoperability.

Key exports: buildClaimBundle(), buildEOB(), serializeFHIRXML(), Patient, Coverage, Claim

Docs: FHIR Health Data


Multi-channel notification system — email (Graph/Resend/SMTP), SMS (Twilio), Teams (Bot Framework), Slack (webhook), in-app.

Key exports: createGraphEmailProvider(), createTeamsBotClient(), createSlackClient(), dispatchNotification(), createGraphMailboxReader()

Docs: Notifications


Document generation (HTML→PDF), e-signature (Documenso), form assembly, and R2 storage.

Key exports: buildCOIHTML(), buildQuoteHTML(), buildDecPageHTML(), buildNOCHTML(), renderToPDF(), exportToCSV(), exportToExcel()

Docs: Document Generation


AI agent orchestration — Durable Object agents, prompt management, Langfuse observability, and model routing.

Key exports: SubmissionAgent, ClaimAgent, UnderwritingAgent, OrchestratorAgent, agent base classes

Docs: AI Agents


Analytics event schema, KPI computation, predictive modeling, AI spend monitoring, and Cloudflare Analytics Engine + Tinybird integration.

Key exports: trackEvent(), computeMGAKPIs(), computeCaptiveKPIs(), predictLossRatio(), scoreRetention(), detectSpendAnomaly(), AnalyticsEvent

Docs: Analytics


Carrier integration layer — appetite evaluation, multi-carrier submission gateway, best-quote selection, and bordereaux SFTP export. Includes built-in database of 6 pre-configured carriers.

Key exports: checkCarrierAppetite(), rankCarriers(), findCarrier(), createCarrierGateway(), generateBordereauxCSV(), transmitBordereauxSftp(), CARRIER_DB

Docs: Carrier Gateway


Terminal window
# Test a single package
pnpm --filter @openinsure/policy test
# Build a package
pnpm --filter @openinsure/rating build
# Type-check
pnpm --filter @openinsure/claims exec tsc --noEmit
# Test a group of related packages
pnpm --filter "@openinsure/{policy,claims,billing,rating}" test