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

better-auth-admin-ui

v0.1.1

Published

Beautiful admin dashboard UI for better-auth

Readme

Better Auth Admin UI

Beautiful admin dashboard UI for better-auth.

Features

  • 📊 User management dashboard
  • 🚫 Ban/unban users with reasons and expiry
  • 👥 Role management
  • 🔐 Session management
  • 👤 User impersonation
  • 🔑 Password reset
  • ⚡ Built with React and TypeScript
  • 🎨 Styled with Tailwind CSS
  • 📱 Fully responsive
  • 🔄 Server Actions support (Next.js)

Installation

npm install better-auth-admin-ui

Requirements

  • better-auth with admin plugin enabled
  • React 18+
  • Next.js 13+ (for server actions)
  • Tailwind CSS (optional but recommended)

Quick Start

1. Set up better-auth with admin plugin

// lib/auth.ts
import { betterAuth } from "better-auth"
import { admin } from "better-auth/plugins"

export const auth = betterAuth({
  // ... your config
  plugins: [
    admin() // Required!
  ]
})

2. Add admin dashboard page

// app/admin/page.tsx
import { BetterAuthAdmin } from 'better-auth-admin-ui'
import { auth } from '@/lib/auth'

export default function AdminPage() {
  return <BetterAuthAdmin auth={auth} />
}

3. Import styles (optional)

If you're using Tailwind CSS, add this to your global CSS:

@import 'better-auth-admin-ui/styles.css';

4. Done!

Visit /admin to see your dashboard.

Advanced Usage

Pre-fetch users for better performance

import { headers } from 'next/headers'

export default async function AdminPage() {
  const users = await auth.api.listUsers({
    headers: await headers()
  })

  return <BetterAuthAdmin auth={auth} initialUsers={users} />
}

Protect the admin route

import { redirect } from 'next/navigation'

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

  if (!session?.user?.role?.includes('admin')) {
    redirect('/')
  }

  return <BetterAuthAdmin auth={auth} />
}

Customization

<BetterAuthAdmin
  auth={auth}
  config={{
    defaultPageSize: 20,
    userColumns: ['name', 'email', 'role', 'createdAt'],
    enableImpersonation: true,
    enableBan: true,
    enableDelete: true,
    onUserBanned: (userId) => console.log('User banned:', userId),
    onUserDeleted: (userId) => console.log('User deleted:', userId),
    onUserRoleChanged: (userId, role) => console.log('Role changed:', userId, role)
  }}
/>

Features

User Management

  • List Users: Paginated table with search and sorting
  • View Details: Complete user information panel
  • Ban/Unban: Ban users with optional expiry date
  • Role Management: Change user roles via dropdown
  • Delete User: Permanent user deletion with confirmation
  • Set Password: Reset user password

Session Management

  • View Sessions: See all active sessions for a user
  • Session Details: IP address, device info, timestamps
  • Revoke Session: Kill individual sessions
  • Revoke All: Logout user from all devices

Impersonation

  • Impersonate: Login as any user
  • Visual Indicators: Clear UI showing impersonation status

Component API

BetterAuthAdmin

Main component that provides the complete admin interface.

interface BetterAuthAdminProps {
  auth: any // better-auth instance
  className?: string
  initialUsers?: User[]
  config?: {
    userColumns?: string[]
    defaultPageSize?: number
    enableImpersonation?: boolean
    enableBan?: boolean
    enableDelete?: boolean
    onUserBanned?: (userId: string) => void
    onUserDeleted?: (userId: string) => void
    onUserRoleChanged?: (userId: string, role: string) => void
  }
}

Using Individual Components

You can also use individual components for custom layouts:

import { UserList, UserDetail } from 'better-auth-admin-ui'

function MyCustomAdmin() {
  return (
    <div>
      <UserList
        users={users}
        onUserSelect={handleSelect}
        onBanUser={handleBan}
        onDeleteUser={handleDelete}
        onImpersonateUser={handleImpersonate}
      />
    </div>
  )
}

Tailwind CSS Setup

If you're using Tailwind CSS, make sure your tailwind.config.js includes the package:

module.exports = {
  content: [
    './app/**/*.{js,ts,jsx,tsx}',
    './node_modules/better-auth-admin-ui/**/*.{js,ts,jsx,tsx}'
  ],
  // ... rest of config
}

Examples

Check out the examples directory for:

  • Next.js App Router implementation
  • Custom styling examples
  • Advanced usage patterns

TypeScript Support

This package is written in TypeScript and includes full type definitions.

import type { User, Session, AdminActions } from 'better-auth-admin-ui'

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Links

Support

If you encounter any issues, please file them on GitHub Issues.