npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sidgaikwad/auth-setup

v1.0.1

Published

Framework-agnostic CLI for setting up authentication with Better Auth, Clerk, and more

Readme

🔐 @sidgaikwad/auth-setup

Production-ready authentication setup in 2 minutes

npm version License: MIT

Setup Better Auth or Clerk with one command. Zero config, framework-agnostic, production-ready.

✨ Features

  • 🎯 Multiple Providers - Better Auth, Clerk (more coming)
  • 🔐 Auth Methods - Email/Password, Google, GitHub OAuth
  • 🗄️ ORM Integration - Auto-detects Drizzle, Prisma
  • 🎨 UI Components - Pre-built Sign In, Sign Up, User Button
  • 🛡️ Route Protection - Middleware for protected routes
  • Framework Agnostic - Next.js, Remix, and more
  • 📦 Zero Config - Smart defaults, works out of the box

🚀 Quick Start

bunx @sidgaikwad/auth-setup

Answer a few questions and you're done! 🎉

📦 What Gets Generated

For Better Auth:

your-project/
├── src/lib/auth.ts              # Auth configuration
├── app/api/auth/[...all]/route.ts  # API endpoints
├── src/components/
│   ├── sign-in.tsx              # Sign in form
│   ├── sign-up.tsx              # Sign up form
│   └── user-button.tsx          # User menu
├── middleware.ts                # Route protection
├── .env.example                 # Environment variables
└── src/db/schema.ts            # Auth tables (if ORM detected)

For Clerk:

your-project/
├── middleware.ts                # Clerk middleware
├── src/components/
│   ├── sign-in.tsx              # Clerk sign-in wrapper
│   └── user-button.tsx          # Clerk user button
└── .env.example                 # Clerk API keys

🎯 Usage

1. Run the CLI

bunx @sidgaikwad/auth-setup

2. Choose your provider

◇ Select your auth provider
│ ❯ Better Auth (Type-safe, modern, self-hosted)
│   Clerk (Managed service, beautiful UI)

◇ Select authentication methods
│ ◉ Email + Password
│ ◉ Google OAuth
│ ◯ GitHub OAuth

◇ Generate UI components?
│ Yes

◇ Generate middleware for route protection?
│ Yes

3. Configure environment variables

# Better Auth
BETTER_AUTH_SECRET=your-secret-here
BETTER_AUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID=your-google-id
GOOGLE_CLIENT_SECRET=your-google-secret

# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your-key
CLERK_SECRET_KEY=your-secret

4. Run migrations (if using Better Auth with ORM)

bun db:generate
bun db:migrate

5. Start your app!

bun dev

💻 Usage in Your App

Server Component (Better Auth)

import { auth } from "@/lib/auth";
import { headers } from "next/headers";

export default async function Page() {
  const session = await auth.api.getSession({ headers: headers() });

  if (!session) {
    return <div>Not logged in</div>;
  }

  return <div>Welcome {session.user.name}!</div>;
}

Client Component

import { SignIn } from "@/components/sign-in";

export default function SignInPage() {
  return <SignIn />;
}

Using Clerk

import { UserButton } from "@/components/user-button";

export default function Navbar() {
  return (
    <nav>
      <UserButton />
    </nav>
  );
}

🔧 Supported Stacks

Frameworks

  • ✅ Next.js 13+ (App Router)
  • ✅ Remix
  • 🔄 SvelteKit (coming soon)

ORMs

  • ✅ Drizzle
  • ✅ Prisma
  • 🔄 Kysely (coming soon)

Databases

  • ✅ PostgreSQL
  • ✅ MySQL
  • ✅ SQLite

🛠️ CLI Options

# Use with specific package manager
npx @sidgaikwad/auth-setup
bunx @sidgaikwad/auth-setup
pnpm dlx @sidgaikwad/auth-setup

📚 Examples

Check out the examples directory:

  • Next.js + Better Auth + Drizzle
  • Next.js + Clerk
  • Remix + Better Auth + Prisma

🤝 Integration with @sidgaikwad/orm-setup

Works seamlessly with @sidgaikwad/orm-setup:

# 1. Setup database
bunx @sidgaikwad/orm-setup

# 2. Setup auth (auto-detects ORM!)
bunx @sidgaikwad/auth-setup

🐛 Troubleshooting

"Database connection failed"

Make sure DATABASE_URL is set in your .env file.

"OAuth redirect URI mismatch"

Check your OAuth provider settings:

  • Google: http://localhost:3000/api/auth/callback/google
  • GitHub: http://localhost:3000/api/auth/callback/github

"Session not found"

Run migrations to create auth tables:

bun db:generate
bun db:migrate

🗺️ Roadmap

v1.1

  • [ ] Lucia support
  • [ ] NextAuth.js support
  • [ ] Magic links
  • [ ] Email verification UI

v2.0

  • [ ] Supabase Auth
  • [ ] Stack Auth
  • [ ] SvelteKit support
  • [ ] 2FA setup

🤝 Contributing

Contributions are welcome! Please check out our Contributing Guide.

📄 License

MIT © Siddharth Gaikwad

🔗 Links


Made with ❤️ by Siddharth Gaikwad