Registry / auth-security / bezzie

bezzie

JSON →
library1.0.1jsnpmunverified

Bezzie is a BFF (Backend for Frontend) OAuth 2.0 authentication library for Cloudflare Workers, currently at v1.0.1 (April 2026). It implements BCP212 (OAuth for Browser-Based Apps) by keeping tokens server-side in Cloudflare KV and issuing session cookies to the frontend, preventing JWTs from ever reaching the browser. It integrates seamlessly with Hono (v4) and supports providers like Auth0, Google, and generic OIDC. Compared to alternatives (Duende BFF, @auth0/nextjs-auth0), Bezzie is framework-agnostic, runs on Cloudflare Workers' edge, and is TypeScript-first with ESM-only distribution. Active development with recent breaking changes in v1.0.0.

npm install bezzie
INSTALL
IMPORT
SIG · BEZZIE
B
bezzie
auth-securityjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createBezzie
import { createBezzie } from 'bezzie'
const { createBezzie } = require('bezzie')
Bezzie is ESM-only; CommonJS require will fail.
providers
import { providers } from 'bezzie'
import * as providers from 'bezzie/providers'
providers is a named export from the main package, not a submodule.
cloudflareKVAdapter
import { cloudflareKVAdapter } from 'bezzie'
import { cloudflareKVAdapter } from 'bezzie/adapters'
Adapter functions are exported from the main entry point since v1.0.0; the previous subpath was removed.
Bezzie
import type { Bezzie } from 'bezzie'
import { Bezzie } from 'bezzie'
Bezzie is a TypeScript interface, not a class. Use type import for compile-time use.
memoryAdapter
import { memoryAdapter } from 'bezzie'
import { MemoryAdapter } from 'bezzie'
In v1.0.0, MemoryAdapter was renamed to memoryAdapter (factory function). Using the class name will cause a runtime error.

Sets up Bezzie with Auth0 provider and memory adapter, mounts auth routes, protects an API endpoint.

import { createBezzie, providers, cloudflareKVAdapter, memoryAdapter } from 'bezzie' import { Hono } from 'hono' type Env = { SESSION_KV: KVNamespace AUTH0_CLIENT_SECRET: string } const app = new Hono<{ Bindings: Env }>() app.use('*', async (c, next) => { const auth = createBezzie({ ...providers.auth0('your-tenant.auth0.com'), clientId: 'your-client-id', clientSecret: c.env.AUTH0_CLIENT_SECRET, adapter: memoryAdapter(), baseUrl: 'https://app.yourproject.com', }) c.set('auth', auth) await next() }) app.route('/auth', (c) => { const auth = c.get('auth') return auth.routes() } as any) app.get('/api/me', (c) => { const user = c.var.user const token = c.var.accessToken return c.json({ user, token }) }) export default app
Debug
Known issues
breakingv1.0.0: adapters changed from class constructors to factory functions (e.g., MemoryAdapter → memoryAdapter).
fix
Replace `new MemoryAdapter()` with `memoryAdapter()`, `new RedisAdapter(client)` with `redisAdapter(client)`. `cloudflareKVAdapter(kv)` remains unchanged.
affects: >=1.0.0
breakingv1.0.0: removed `providerHints`, `cloudflareKV`, and `Bezzie.cache`. The adapter configuration now uses a factory function pattern.
fix
Migrate to the new adapter factory functions (e.g., cloudflareKVAdapter(env.SESSION_KV)).
affects: >=1.0.0
gotchaThe library is ESM-only (no CommonJS support). Using `require('bezzie')` will throw.
fix
Use `import` syntax or set `"type": "module"` in package.json.
affects: >=0.1.0
gotchaPeer dependency on Hono ^4.0.0. Will not work with Hono v3 or earlier.
fix
Upgrade Hono to v4: `npm install hono@^4.0.0`.
affects: >=0.1.0
gotchaSession adapter must be provided. Using `memoryAdapter()` is fine for development but sessions are lost on worker restart.
fix
In production, use `cloudflareKVAdapter(env.SESSION_KV)` or a persistent adapter.
affects: >=0.1.0
deprecatedThe internal route paths are customizable via `routes` config (v1.0.0+). Defaults may collide with existing routes.
fix
Use `routes: { login: '/signin', callback: '/cb', logout: '/signout' }` to avoid conflicts.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'bezzie'
Old version (pre-v0.1.5) had incorrect dist output path.
fix
Update to bezzie@^1.0.0: `npm install bezzie@latest`
TypeError: cloudflareKVAdapter is not a function
Importing from wrong subpath; adapter moved to main export in v1.0.0.
fix
Change `import { cloudflareKVAdapter } from 'bezzie/adapters'` to `import { cloudflareKVAdapter } from 'bezzie'`
Error: Session adapter must be a function returning an object with get/set/destroy
Passed an adapter instance instead of a factory function (v1.0.0+).
fix
Use factory functions: `cloudflareKVAdapter(env.SESSION_KV)` instead of `new CloudflareKVAdapter(env.SESSION_KV)`
Cannot use import statement outside a module
Project not configured for ESM.
fix
Add `"type": "module"` to package.json or rename file to .mjs
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
honorequiredBezzie is designed as a Hono middleware and requires hono ^4.0.0 for routing and context handling.
Agent activity
29 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources
bezzie — npm install bezzie · libregistry