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

easy-auth-sdk

v1.0.0

Published

A developer-centric authentication integration module with built-in UI and multiple auth methods

Readme

🔐 Easy Auth SDK

The authentication solution that just works™

npm version TypeScript License: MIT PRs Welcome


🌟 Why Easy Auth?

Building authentication is hard. Building it securely is even harder. We've all been there:

  • 😩 Spending days setting up auth instead of building features
  • 🔧 Wrestling with OAuth provider documentation
  • 🎨 Building the same login forms over and over
  • 🔒 Worrying about security vulnerabilities
  • 📚 Dealing with incomplete or confusing documentation

Easy Auth SDK solves all of this. One package, five minutes, and you're done.

// This is all you need. Seriously.
import { createAuthHandlers } from 'easy-auth-sdk/next'

export const { GET, POST } = createAuthHandlers({
  database: { url: process.env.DATABASE_URL },
  providers: { google: { enabled: true } }
})

✨ Features

🎯 Dead Simple Setup

npm install easy-auth-sdk

That's it. No complex configuration. Sensible defaults. It just works.

🎨 Beautiful UI Included

Pre-built components with Shadcn UI + Tailwind. Fully customizable or bring your own.

🔐 Secure by Default

Rate limiting, CSRF protection, secure sessions, and password policies built-in. Sleep easy.

🚀 Framework Ready

First-class Next.js support. Express coming soon. Works with any Node.js app.

📦 Batteries Included

Email/password, OAuth (Google, GitHub, etc.), password reset, and more out of the box.

💪 TypeScript First

Full type safety. Autocomplete everything. Catch errors before runtime.

🚀 Quick Start

1. Install

npm install easy-auth-sdk

# Required peer dependencies (if not already installed)
npm install react react-dom next

2. Set Environment Variables

# .env.local
DATABASE_URL="postgresql://user:pass@localhost:5432/myapp"
AUTH_SECRET="your-secret-key-min-32-chars" # Generate with: openssl rand -base64 32

3. Create Auth API Route

// app/api/auth/[...auth]/route.ts
import { createAuthHandlers } from 'easy-auth-sdk/next'

export const { GET, POST } = createAuthHandlers({
  database: { 
    type: 'postgres',
    url: process.env.DATABASE_URL! 
  },
  session: {
    secret: process.env.AUTH_SECRET!
  },
  providers: {
    emailPassword: { enabled: true },
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID!,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET!
    }
  }
})

4. Add Provider to Layout

// app/layout.tsx
import { NextAuthProvider } from 'easy-auth-sdk/next/client'

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <NextAuthProvider>
          {children}
        </NextAuthProvider>
      </body>
    </html>
  )
}

5. Create Login Page

// app/login/page.tsx
'use client'

import { AuthComponent } from 'easy-auth-sdk/react'
import { useNextAuth } from 'easy-auth-sdk/next/client'

export default function LoginPage() {
  const { signIn, signUp, oauthSignIn, loading, error } = useNextAuth()

  return (
    <AuthComponent
      onSignIn={signIn}
      onSignUp={signUp}
      onOAuthSignIn={oauthSignIn}
      providers={[
        { id: 'google', name: 'Google' },
        { id: 'github', name: 'GitHub' }
      ]}
      loading={loading}
      error={error}
    />
  )
}

That's it! You now have a fully functional auth system with:

  • ✅ Beautiful login/signup UI
  • ✅ Email/password authentication
  • ✅ Social logins
  • ✅ Secure sessions
  • ✅ Password reset flow
  • ✅ TypeScript support

🎨 UI Components

All components are:

  • 🎨 Beautifully designed with Shadcn UI
  • 📱 Fully responsive out of the box
  • Accessible (WCAG 2.1 compliant)
  • 🎯 Customizable with Tailwind classes
  • 🌙 Dark mode ready

🔧 Advanced Usage

🛡️ Protecting Pages

Server Components

import { getServerSession } from 'easy-auth-sdk/next/server'
import { redirect } from 'next/navigation'

export default async function DashboardPage() {
  const session = await getServerSession()
  
  if (!session) {
    redirect('/login')
  }

  return <h1>Welcome, {session.user.name}!</h1>
}

Client Components

'use client'

import { withNextAuth } from 'easy-auth-sdk/next/client'

function ProtectedComponent() {
  return <div>Secret content 🤫</div>
}

export default withNextAuth(ProtectedComponent)

🔌 OAuth Providers

Setting up OAuth is as simple as adding credentials:

providers: {
  google: {
    clientId: process.env.GOOGLE_CLIENT_ID!,
    clientSecret: process.env.GOOGLE_CLIENT_SECRET!
  },
  github: {
    clientId: process.env.GITHUB_CLIENT_ID!,
    clientSecret: process.env.GITHUB_CLIENT_SECRET!
  },
  // Add more providers...
}
  • ✅ Google
  • ✅ GitHub
  • ✅ Facebook
  • ✅ Twitter/X
  • ✅ Microsoft (coming soon)
  • ✅ Apple (coming soon)
  • ✅ Discord (coming soon)
  • Custom OAuth

🎨 Customizing UI

Using Theme Variables

:root {
  --primary: 220 90% 56%;           /* Your brand color */
  --primary-foreground: 0 0% 100%;  /* Text on primary */
  /* ... more variables */
}

Custom Styling

<AuthComponent
  className="custom-auth-wrapper"
  texts={{
    signIn: {
      title: "Welcome Back! 👋",
      description: "Sign in to continue your journey"
    }
  }}
/>

Headless Mode

import { useNextAuth } from 'easy-auth-sdk/next/client'

function CustomLoginForm() {
  const { signIn, loading, error } = useNextAuth()
  
  // Build your own UI
  return (
    <form onSubmit={(e) => {
      e.preventDefault()
      signIn(email, password)
    }}>
      {/* Your custom form */}
    </form>
  )
}

🔐 Security Configuration

const config = {
  security: {
    rateLimit: {
      maxAttempts: 5,
      windowMs: 15 * 60 * 1000 // 15 minutes
    },
    passwordPolicy: {
      minLength: 8,
      requireUppercase: true,
      requireNumbers: true,
      requireSpecialChars: true
    },
    csrf: {
      enabled: true
    }
  }
}

🪝 Event Hooks

const config = {
  callbacks: {
    onSignUp: async ({ user }) => {
      // Send welcome email
      await sendWelcomeEmail(user.email)
      
      // Track analytics
      analytics.track('user_signup', { userId: user.id })
    },
    
    onSignIn: async ({ user, account }) => {
      // Update last login
      await updateLastLogin(user.id)
    },
    
    onSignOut: async ({ user }) => {
      // Cleanup tasks
      await clearUserCache(user.id)
    }
  }
}

📊 Database

Schema Overview

Easy Auth automatically creates and manages these tables:

┌─────────────┐     ┌──────────────┐     ┌──────────────┐
│   users     │     │   accounts   │     │   sessions   │
├─────────────┤     ├──────────────┤     ├──────────────┤
│ id          │◄────┤ userId       │◄────┤ userId       │
│ email       │     │ provider     │     │ sessionToken │
│ name        │     │ providerId   │     │ expiresAt    │
│ password    │     │ accessToken  │     │ createdAt    │
│ verified    │     │ refreshToken │     │ updatedAt    │
│ createdAt   │     │ createdAt    │     └──────────────┘
│ updatedAt   │     │ updatedAt    │
└─────────────┘     └──────────────┘

Migrations

# Generate migration files
npx drizzle-kit generate:pg

# Apply migrations
npx drizzle-kit push:pg

# View database studio
npx drizzle-kit studio

🔄 Migration from NextAuth

Moving from NextAuth? It's seamless:

- import NextAuth from 'next-auth'
- import GoogleProvider from 'next-auth/providers/google'
+ import { createAuthHandlers } from 'easy-auth-sdk/next'

- export default NextAuth({
-   providers: [
-     GoogleProvider({
-       clientId: process.env.GOOGLE_CLIENT_ID,
-       clientSecret: process.env.GOOGLE_CLIENT_SECRET,
-     })
-   ]
- })

+ export const { GET, POST } = createAuthHandlers({
+   providers: {
+     google: {
+       clientId: process.env.GOOGLE_CLIENT_ID!,
+       clientSecret: process.env.GOOGLE_CLIENT_SECRET!
+     }
+   }
+ })
  1. Database Compatible: Our schema is NextAuth-compatible
  2. Similar API: Most functions have direct equivalents
  3. Better DX: Less configuration, more features
  4. Migration Script: Coming soon!

📚 Examples

Next.js App Router

cd examples/next-app
npm install
npm run dev

Express.js (Coming Soon)

cd examples/express-app
npm install
npm run dev

🛣️ Roadmap

  • [x] Email/Password authentication
  • [x] OAuth providers (Google, GitHub, etc.)
  • [x] Next.js integration
  • [x] Beautiful UI components
  • [x] TypeScript support
  • [x] Rate limiting & security
  • [ ] Two-factor authentication (2FA)
  • [ ] Magic link authentication
  • [ ] Express.js adapter
  • [ ] Remix adapter
  • [ ] Email service integrations
  • [ ] Admin dashboard
  • [ ] Multi-tenant support

🤝 Contributing

We love contributions! Please see our Contributing Guide for details.

# Clone the repo
git clone https://github.com/your-org/easy-auth-sdk

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

📄 License

MIT © Your Company


Built with ❤️ by developers, for developers

If Easy Auth helped you ship faster, consider sponsoring the project!