{"id":18164,"library":"bezzie","title":"Bezzie","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/neilpmas/bezzie","tags":["javascript","bff","backend-for-frontend","jwt","pkce","token-rotation","oidc","cloudflare-workers","oauth2","typescript"],"install":[{"cmd":"npm install bezzie","lang":"bash","label":"npm"},{"cmd":"yarn add bezzie","lang":"bash","label":"yarn"},{"cmd":"pnpm add bezzie","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Bezzie is designed as a Hono middleware and requires hono ^4.0.0 for routing and context handling.","package":"hono","optional":false}],"imports":[{"note":"Bezzie is ESM-only; CommonJS require will fail.","wrong":"const { createBezzie } = require('bezzie')","symbol":"createBezzie","correct":"import { createBezzie } from 'bezzie'"},{"note":"providers is a named export from the main package, not a submodule.","wrong":"import * as providers from 'bezzie/providers'","symbol":"providers","correct":"import { providers } from 'bezzie'"},{"note":"Adapter functions are exported from the main entry point since v1.0.0; the previous subpath was removed.","wrong":"import { cloudflareKVAdapter } from 'bezzie/adapters'","symbol":"cloudflareKVAdapter","correct":"import { cloudflareKVAdapter } from 'bezzie'"},{"note":"Bezzie is a TypeScript interface, not a class. Use type import for compile-time use.","wrong":"import { Bezzie } from 'bezzie'","symbol":"Bezzie","correct":"import type { Bezzie } from 'bezzie'"},{"note":"In v1.0.0, MemoryAdapter was renamed to memoryAdapter (factory function). Using the class name will cause a runtime error.","wrong":"import { MemoryAdapter } from 'bezzie'","symbol":"memoryAdapter","correct":"import { memoryAdapter } from 'bezzie'"}],"quickstart":{"code":"import { createBezzie, providers, cloudflareKVAdapter, memoryAdapter } from 'bezzie'\nimport { Hono } from 'hono'\n\ntype Env = {\n  SESSION_KV: KVNamespace\n  AUTH0_CLIENT_SECRET: string\n}\n\nconst app = new Hono<{ Bindings: Env }>()\n\napp.use('*', async (c, next) => {\n  const auth = createBezzie({\n    ...providers.auth0('your-tenant.auth0.com'),\n    clientId: 'your-client-id',\n    clientSecret: c.env.AUTH0_CLIENT_SECRET,\n    adapter: memoryAdapter(),\n    baseUrl: 'https://app.yourproject.com',\n  })\n  c.set('auth', auth)\n  await next()\n})\n\napp.route('/auth', (c) => {\n  const auth = c.get('auth')\n  return auth.routes()\n} as any)\n\napp.get('/api/me', (c) => {\n  const user = c.var.user\n  const token = c.var.accessToken\n  return c.json({ user, token })\n})\n\nexport default app","lang":"typescript","description":"Sets up Bezzie with Auth0 provider and memory adapter, mounts auth routes, protects an API endpoint."},"warnings":[{"fix":"Replace `new MemoryAdapter()` with `memoryAdapter()`, `new RedisAdapter(client)` with `redisAdapter(client)`. `cloudflareKVAdapter(kv)` remains unchanged.","message":"v1.0.0: adapters changed from class constructors to factory functions (e.g., MemoryAdapter → memoryAdapter).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Migrate to the new adapter factory functions (e.g., cloudflareKVAdapter(env.SESSION_KV)).","message":"v1.0.0: removed `providerHints`, `cloudflareKV`, and `Bezzie.cache`. The adapter configuration now uses a factory function pattern.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use `import` syntax or set `\"type\": \"module\"` in package.json.","message":"The library is ESM-only (no CommonJS support). Using `require('bezzie')` will throw.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade Hono to v4: `npm install hono@^4.0.0`.","message":"Peer dependency on Hono ^4.0.0. Will not work with Hono v3 or earlier.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"In production, use `cloudflareKVAdapter(env.SESSION_KV)` or a persistent adapter.","message":"Session adapter must be provided. Using `memoryAdapter()` is fine for development but sessions are lost on worker restart.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `routes: { login: '/signin', callback: '/cb', logout: '/signout' }` to avoid conflicts.","message":"The internal route paths are customizable via `routes` config (v1.0.0+). Defaults may collide with existing routes.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Update to bezzie@^1.0.0: `npm install bezzie@latest`","cause":"Old version (pre-v0.1.5) had incorrect dist output path.","error":"Cannot find module 'bezzie'"},{"fix":"Change `import { cloudflareKVAdapter } from 'bezzie/adapters'` to `import { cloudflareKVAdapter } from 'bezzie'`","cause":"Importing from wrong subpath; adapter moved to main export in v1.0.0.","error":"TypeError: cloudflareKVAdapter is not a function"},{"fix":"Use factory functions: `cloudflareKVAdapter(env.SESSION_KV)` instead of `new CloudflareKVAdapter(env.SESSION_KV)`","cause":"Passed an adapter instance instead of a factory function (v1.0.0+).","error":"Error: Session adapter must be a function returning an object with get/set/destroy"},{"fix":"Add `\"type\": \"module\"` to package.json or rename file to .mjs","cause":"Project not configured for ESM.","error":"Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}