BolkAuth is a self-hosted authentication toolkit for TypeScript applications. It provides a core auth engine, React hooks, Next.js App Router helpers, middleware, CLI scaffolding, and database adapters while keeping your user data in your own database.
Start Here
Use these pages in order when adding BolkAuth to a new app:
- Installation - install the packages for your framework and adapter.
- Quick Start - wire
createBolkAuth, the route handler, provider, and middleware. - Configuration - set secrets, sessions, email, OAuth, OTP, and onboarding options.
- Core Concepts - understand the engine, adapter boundary, session model, and request flow.
Main Sections
| Section | Use it for |
|---|---|
| Authentication | Email/password, OAuth, OTP, magic links, and sessions |
| React | Provider setup and headless hooks |
| Next.js | App Router route handlers and server helpers |
| Middleware | Protecting routes and configuring public paths |
| Server Actions | Reading the user and mutating profile data server-side |
| Adapters | Drizzle, Prisma, MongoDB notes, and custom adapter implementations |
| CLI | Project scaffolding and generated files |
| Security | Cookie, JWT, OAuth, rate limiting, and production hardening |
| Deployment | Environment variables, OAuth callback URLs, and database pooling |
| API Reference | Endpoints, config shape, hooks, helpers, and adapter methods |
| Troubleshooting | Common setup, runtime, OAuth, database, and type errors |
Package Map
| Package | Purpose |
|---|---|
@bolkauth/core | Runtime-independent auth engine, sessions, password hashing, OTP, OAuth, and adapter types |
@bolkauth/react | BolkAuthProvider and headless hooks for client UI |
@bolkauth/nextjs | App Router route handler, middleware, and server helpers |
@bolkauth/adapter-drizzle | Drizzle ORM adapter with dialect-specific exports |
@bolkauth/adapter-prisma | Prisma adapter and schema examples |
@bolkauth/adapter-mongodb | MongoDB adapter for document storage |
@bolkauth/cli | Scaffolding commands for auth setup and adapter files |