Skip to main content
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

@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

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

Shared runtime configuration, environment variable schemas (Zod), and feature flags. Key exports: parseEnv(), getFeatureFlag(), feature flag constants

@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

@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

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

Premium billing, installment plans, invoice generation, commission accounting, and trust ledger management. Key exports: createInstallmentPlan(), calcReturnPremium(), calcCommission(), generateInvoice(), calcProRataRefund() Docs: Premium Billing

@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

Underwriting rules engine, authority matrix enforcement, referral triggers, and DA validation. Key exports: evaluateRules(), validateBindingAuthority(), checkAuthorityMatrix(), UWRule Docs: Rating Engine & Underwriting

@openinsure/producer

Producer / agency management — license tracking, appointment management, commission rates, and performance metrics. Key exports: createProducer(), updateLicense(), calcProducerCommission(), validateAppointment()

@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

@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

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

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

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

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

@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

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

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

@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

X12 EDI transaction parser and builder — 834, 835, 837P, 210, 211. Key exports: parseX12(), parse834(), parse835(), build837P(), parse210(), parse211() Docs: X12 EDI

@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

@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

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

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

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

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

# 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