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:*".
Core Platform
Section titled “Core Platform”@openinsure/types
Section titled “@openinsure/types”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
@openinsure/db
Section titled “@openinsure/db”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)
@openinsure/config
Section titled “@openinsure/config”Shared runtime configuration, environment variable schemas (Zod), and feature flags.
Key exports: parseEnv(), getFeatureFlag(), feature flag constants
@openinsure/auth
Section titled “@openinsure/auth”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)
Insurance Domain
Section titled “Insurance Domain”@openinsure/policy
Section titled “@openinsure/policy”Policy lifecycle state machine, transition validation, endorsement logic, cancellation, and renewal.
Key exports: validateTransition(), VALID_TRANSITIONS, calcReturnPremium(), PolicyStateMachine
Docs: Policy Lifecycle
@openinsure/claims
Section titled “@openinsure/claims”Claims lifecycle management, reserve calculations, IBNR modeling, subrogation tracking, and litigation workflow.
Key exports: createClaim(), updateReserve(), calcIBNR(), ClaimStateMachine, reserve adequacy flags
Docs: Claims Management
@openinsure/billing
Section titled “@openinsure/billing”Premium billing, installment plans, invoice generation, commission accounting, and trust ledger management.
Key exports: createInstallmentPlan(), calcReturnPremium(), calcCommission(), generateInvoice(), calcProRataRefund()
Docs: Premium Billing
@openinsure/rating
Section titled “@openinsure/rating”Deterministic actuarial rating engine — factor waterfall, rate table lookups, schedule rating, experience modification.
Key exports: rateSubmission(), explainRating(), applyScheduleRating(), RatingInput, RatingAudit
Docs: Rating Engine
@openinsure/underwriting
Section titled “@openinsure/underwriting”Underwriting rules engine, authority matrix enforcement, referral triggers, and DA validation.
Key exports: evaluateRules(), validateBindingAuthority(), checkAuthorityMatrix(), UWRule
Docs: Rating Engine & Underwriting
@openinsure/producer
Section titled “@openinsure/producer”Producer / agency management — license tracking, appointment management, commission rates, and performance metrics.
Key exports: createProducer(), updateLicense(), calcProducerCommission(), validateAppointment()
@openinsure/coi
Section titled “@openinsure/coi”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
MGA / Specialty
Section titled “MGA / Specialty”@openinsure/delegated-authority
Section titled “@openinsure/delegated-authority”Delegated authority agreement management, authority matrix configuration, breach detection, and aggregate tracking.
Key exports: validateBindingAuthority(), checkAggregateLimits(), recordBreach(), DAMatrix
Docs: Delegated Authority
@openinsure/reinsurance
Section titled “@openinsure/reinsurance”Quota share, XOL, and aggregate XL treaty management, cession calculations, and cession statements.
Key exports: calcQuotaShareCession(), calcXOLCession(), calcAggregateXLCession(), compileCessionStatement()
Docs: Reinsurance Management
@openinsure/stop-loss
Section titled “@openinsure/stop-loss”Specific and aggregate stop-loss calculations, premium estimation, and fund ratio analysis for captives.
Key exports: calcSpecificStopLoss(), calcAggregateStopLoss(), estimateSpecificSLPremium(), buildStopLossSummary()
Docs: Stop-Loss Insurance
@openinsure/captive-admin
Section titled “@openinsure/captive-admin”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
@openinsure/loss-runs
Section titled “@openinsure/loss-runs”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
Compliance & Regulated
Section titled “Compliance & Regulated”@openinsure/compliance
Section titled “@openinsure/compliance”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
@openinsure/domicile
Section titled “@openinsure/domicile”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
@openinsure/hipaa
Section titled “@openinsure/hipaa”HIPAA compliance utilities — PHI field taxonomy, audit logging, runtime redaction, and BAA tracking.
Key exports: redactPHI(), logPHIAccess(), PHI_FIELDS, validateBAA()
Docs: HIPAA Compliance
Standards & Integrations
Section titled “Standards & Integrations”@openinsure/acord
Section titled “@openinsure/acord”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
@openinsure/x12
Section titled “@openinsure/x12”X12 EDI transaction parser and builder — 834, 835, 837P, 210, 211.
Key exports: parseX12(), parse834(), parse835(), build837P(), parse210(), parse211()
Docs: X12 EDI
@openinsure/fhir
Section titled “@openinsure/fhir”FHIR R4 resource builders and serializers for health data interoperability.
Key exports: buildClaimBundle(), buildEOB(), serializeFHIRXML(), Patient, Coverage, Claim
Docs: FHIR Health Data
Infrastructure & Utilities
Section titled “Infrastructure & Utilities”@openinsure/notify
Section titled “@openinsure/notify”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
@openinsure/documents
Section titled “@openinsure/documents”Document generation (HTML→PDF), e-signature (Documenso), form assembly, and R2 storage.
Key exports: buildCOIHTML(), buildQuoteHTML(), buildDecPageHTML(), buildNOCHTML(), renderToPDF(), exportToCSV(), exportToExcel()
Docs: Document Generation
@openinsure/agents
Section titled “@openinsure/agents”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
@openinsure/analytics
Section titled “@openinsure/analytics”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
@openinsure/carrier
Section titled “@openinsure/carrier”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
Running Package Commands
Section titled “Running Package Commands”# Test a single packagepnpm --filter @openinsure/policy test
# Build a packagepnpm --filter @openinsure/rating build
# Type-checkpnpm --filter @openinsure/claims exec tsc --noEmit
# Test a group of related packagespnpm --filter "@openinsure/{policy,claims,billing,rating}" test