Skip to main content
This page covers how to set up the plugin locally, run tests, build the package, and publish a release. The source repository is at github.com/Amank-root/better-auth-razorpay and is released under the MIT license.

Prerequisites

You need a recent version of Node.js and a package manager. The project uses bun for development tasks, but npm works for publishing.

Install dependencies

Clone the repository and install dependencies:

Project structure

Development commands

Run type checking

Run tests

The test suite covers error codes, webhook handlers, metadata helpers, plugin construction with and without subscriptions, Razorpay input serializers, schema definitions, signature utilities, general utilities, and the webhook endpoint.

Build the package

This uses tsup to produce ESM output and TypeScript declaration files in the dist/ directory.

Publish a release

The prepublishOnly script in package.json automatically runs bun run build before publishing, so you do not need to build manually.

Writing tests

Tests use Vitest. Add a new test file in test/ following the existing naming convention (<module>.test.ts). Import the module under test from src/ and assert against the exported functions.
test/example.test.ts

Peer dependencies

The plugin declares these peer dependencies:
  • better-auth ^1.7.0
  • @better-auth/core ^1.7.0
  • typescript ^5.6.3
Optional peer dependencies for React hooks:
  • @tanstack/react-query ^5.104.3
  • react ^19.3.0
Bundled dependencies:
  • razorpay ^2.9.8
  • zod ^4.6.7
  • defu
Make sure your local environment satisfies the peer dependencies when testing integration scenarios.

License

The project is released under the MIT license.