Better Auth plugin for OpenMeter usage metering, entitlements, API key tracking, organization customers, React hooks, and billing provider bridges (Stripe, Polar, Razorpay, Creem, Dodo Payments, Autumn). Current stable version 0.5.0, released monthly. Key differentiators: seamless OpenMeter integration with Better Auth auth lifecycle, support for both greenfield runtime and catalog/helper modes, built-in billing catalog DSL with recurring-first plans/add-ons/top-ups, and provider-aware compilation for multiple billing providers.
npm install better-auth-openmeter-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Server-side setup of Better Auth with the OpenMeter plugin, including customer creation on sign-up and event tracking.
Run your Better Auth migration/generation step after adding the plugin to your auth config.
Update plugin configuration to use the catalog DSL: define plans with recurring, add-ons, and top-ups as described in the README.
Use import { openmeterClientPlugin } from 'better-auth-openmeter-plugin/client'.Ensure your project runs on Node >=20 and uses ESM (type: 'module' in package.json).
Explicitly set baseUrl to your OpenMeter instance URL (e.g., https://openmeter.cloud or http://127.0.0.1:8888 for local dev).
Update to v0.4.0 or later: npm install better-auth-openmeter-plugin@latest
Use import { openmeterPlugin } from 'better-auth-openmeter-plugin'Run your database migration (e.g., npx better-auth generate && npx better-auth migrate) to add the openmeterCustomerId column.
Ensure OPENMETER_API_KEY environment variable is set and valid. In local dev, use openmeterClient with a mock or local server.