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

nextjs-auth-starter

v1.1.5

Published

CLI tool to set up Next.js authentication with better-auth, PostgreSQL, and Drizzle ORM. Usage: npx nextjs-auth-starter init

Downloads

34

Readme

Better Auth Kit

npm version License: MIT Downloads

A CLI tool that sets up complete authentication for Next.js projects using Better Auth with PostgreSQL and Drizzle ORM.

⚡ Quick Start: npx nextjs-auth-starter init

What you get

  • 🔐 Complete auth pages (signin, signup, forgot password, email verification)
  • 🗄️ Database schema with Drizzle ORM
  • ⚙️ Better Auth configuration with session management
  • 🛡️ Route protection middleware
  • 📱 Dashboard pages with profile management
  • 🔗 Google OAuth integration (optional)
  • 📧 Email service with Mailjet integration
  • 🎨 Beautiful UI with shadcn/ui components

🚀 Setup Guide

Prerequisites

  • Next.js 14+ with App Router
  • Must use src/ directory structure
  • PostgreSQL database
  • Node.js 18+

Step 1: Create Next.js Project

IMPORTANT: You MUST use the src/ directory structure:

npx create-next-app@latest my-app --typescript --tailwind --eslint --app --src-dir
cd my-app

Step 2: Initialize Authentication

npx nextjs-auth-starter init

This automatically:

  • ✅ Installs all required dependencies
  • ✅ Creates auth pages in src/app/auth/
  • ✅ Sets up dashboard in src/app/dashboard/
  • ✅ Adds UI components to src/components/
  • ✅ Configures database schema in src/lib/
  • ✅ Updates config files (Tailwind, PostCSS, etc.)

Step 3: Environment Setup

Copy .env.example to .env.local and configure:

# Database (Required)
DATABASE_URL="postgresql://username:password@host:port/database"

# Better Auth (Required)
BETTER_AUTH_SECRET="your-32-character-secret-key"
BETTER_AUTH_URL="http://localhost:3000"
NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000"

# Google OAuth (Optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

# Email Service - Mailjet (Required for email features)
MAILJET_API_KEY="your-mailjet-api-key"
MAILJET_SECRET_KEY="your-mailjet-secret-key"
MAILJET_FROM_EMAIL="[email protected]"
MAILJET_FROM_NAME="Your App Name"

Step 4: Database Setup

npm run db:generate  # Generate schema files
npm run db:push      # Create database tables

Step 5: Start Development

npm run dev

🎉 Done! Visit these routes:

  • /auth/signin - Sign in page
  • /auth/signup - Sign up page
  • /dashboard - Protected dashboard

Service Setup

Database (NeonDB Recommended)

  1. Create account at neon.tech
  2. Create new project and database
  3. Copy connection string to .env.local

Email Service (Mailjet)

  1. Create account at mailjet.com
  2. Get API key and secret from dashboard
  3. Verify your sender email/domain
  4. Add credentials to .env.local

Google OAuth (Optional)

  1. Go to Google Cloud Console
  2. Create OAuth 2.0 credentials
  3. Add your domains to authorized origins
  4. Add credentials to .env.local

What's Included

Pages

  • /auth/signin - Login page
  • /auth/signup - Registration page
  • /auth/forgot-password - Password reset
  • /auth/verify-email - Email verification
  • /dashboard - Protected dashboard
  • /dashboard/profile - User profile management

Database Schema

  • Users, sessions, accounts, and verification tokens tables
  • Drizzle ORM integration with type safety

Middleware

  • Automatic route protection for /dashboard/*
  • Redirects for unauthenticated users

Available Commands

npm run db:generate  # Generate migration files
npm run db:push      # Push schema to database
npm run db:studio    # Open database browser

Customization

After setup, you can modify:

  • Database schema: src/lib/schema.ts
  • Auth configuration: src/lib/auth.ts
  • UI components: src/components/
  • Styling: tailwind.config.js and app/globals.css

License

MIT

Support

For issues and questions, please create an issue on the GitHub repository.