Skip to content

wiseiodev/dubs-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@wiseiodev/dubs-auth

All-in-one Better Auth + Stripe + Drizzle toolkit for Next.js App Router apps.

Requirements

  • Node 24 (.nvmrc included)
  • pnpm 10.31.0 via packageManager

Install

pnpm add @wiseiodev/dubs-auth

To use the CLI in a consuming app, run via pnpm exec:

pnpm exec dubs-auth --help

Quick Start

# scaffold env template, config, and Next route handlers
pnpm exec dubs-auth init

# generate schema ownership files for your host app
pnpm exec dubs-auth generate schema

Runtime Example

import {
  createAuthRouteHandlers,
  createDubsAuth,
  dubsAuthSchema,
} from '@wiseiodev/dubs-auth';

export const auth = createDubsAuth({
  baseUrl: process.env.BETTER_AUTH_URL!,
  secret: process.env.BETTER_AUTH_SECRET!,
  database: db,
  databaseSchema: dubsAuthSchema,
  providers: {
    emailPassword: { enabled: true },
  },
  stripe: {
    secretKey: process.env.STRIPE_SECRET_KEY!,
    webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
    plans: [
      {
        key: 'starter',
        displayName: 'Starter',
        prices: {
          monthly: process.env.STRIPE_STARTER_MONTHLY_PRICE_ID!,
          annual: process.env.STRIPE_STARTER_ANNUAL_PRICE_ID!,
        },
      },
    ],
  },
});

export const { GET, POST } = createAuthRouteHandlers(auth);

Docs

Example App

A runnable Next.js App Router sample lives at:

This example currently installs the published npm package and commits its own PGlite + Drizzle migration files for immediate local verification.

dubs-auth generate schema in the published package now scaffolds the full auth table set (account, verification, invitation included).

Example Smoke Test

pnpm --dir examples/next-app-router install
pnpm --dir examples/next-app-router exec dubs-auth generate schema --cwd .
cp examples/next-app-router/.env.example examples/next-app-router/.env
pnpm --dir examples/next-app-router db:migrate
PORT=4000 pnpm --dir examples/next-app-router dev

Then verify:

  1. Sign up at /sign-up
  2. Sign in at /sign-in
  3. Confirm session state at /dashboard
  4. Open /billing (without Stripe envs this should return a clear "not configured" response)

CLI Help

pnpm exec dubs-auth --help
pnpm exec dubs-auth help init

Local Development

pnpm lint
pnpm run format:check
pnpm typecheck
pnpm test
pnpm build
pnpm run quality

For CLI development inside this repository:

# run source directly
node --import tsx src/cli/index.ts --help

# run built artifact
node dist/cli/index.js --help

Commit Convention

This repo uses Conventional Commits with a required scope.

  • Pass: feat(cli): add --help coverage
  • Fail: feat: add --help coverage

Husky runs commitlint on commit-msg locally.

Run pnpm install once per clone to install hooks via prepare.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors