{"id":41388,"library":"learn-auth-sdk","title":"learn-auth-sdk","description":"An open-source Auth SDK designed for decentralized tenant backends using Cloudflare D1. Version 0.3.1 is the current stable release. It offers multi-tenant RBAC authentication with TypeScript support. Differentiates by targeting Cloudflare Workers and D1 databases, unlike general-purpose auth libraries. Release cadence is rapid as it is in early development.","status":"active","version":"0.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/carsontkempf/learn","tags":["javascript","auth","authentication","rbac","multi-tenant","better-auth","d1","cloudflare","typescript"],"install":[{"cmd":"npm install learn-auth-sdk","lang":"bash","label":"npm"},{"cmd":"yarn add learn-auth-sdk","lang":"bash","label":"yarn"},{"cmd":"pnpm add learn-auth-sdk","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for authentication logic","package":"better-auth","optional":false}],"imports":[{"note":"ESM-only; CommonJS require not supported.","wrong":"const LearnAuth = require('learn-auth-sdk')","symbol":"LearnAuth","correct":"import { LearnAuth } from 'learn-auth-sdk'"},{"note":"Named export, not default.","wrong":"import createAuthClient from 'learn-auth-sdk'","symbol":"createAuthClient","correct":"import { createAuthClient } from 'learn-auth-sdk'"},{"note":"TypeScript type-only import to avoid runtime overhead.","wrong":"import { AuthConfig } from 'learn-auth-sdk'","symbol":"type AuthConfig","correct":"import type { AuthConfig } from 'learn-auth-sdk'"}],"quickstart":{"code":"import { LearnAuth, createAuthClient } from 'learn-auth-sdk';\nimport { D1Database } from '@cloudflare/workers-types';\n\nconst env = { DB: {} as D1Database };\nconst auth = new LearnAuth({\n  database: env.DB,\n  secret: process.env.AUTH_SECRET ?? 'default-secret'\n});\n\nconst client = createAuthClient(auth);\n\nasync function example() {\n  const user = await client.register({\n    email: 'user@example.com',\n    password: 'securePassword123'\n  });\n  console.log('Registered user:', user);\n}\n\nexample().catch(console.error);","lang":"typescript","description":"Initializes LearnAuth with a Cloudflare D1 database and registers a new user."},"warnings":[{"fix":"Update calls to createAuthClient: pass new LearnAuth(config) instead of inline config.","message":"API changed from v0.2.x to v0.3.0: createAuthClient now requires a LearnAuth instance instead of options object.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Use only in Cloudflare Workers or Node.js with a D1-compatible adapter.","message":"Only works in Cloudflare Workers environment due to D1 dependency.","severity":"gotcha","affected_versions":"*"},{"fix":"Replace 'databaseUrl' with 'database' pointing to a D1Database instance.","message":"The 'databaseUrl' option in LearnAuth constructor is deprecated; use 'database' with a D1 binding instead.","severity":"deprecated","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'0.3.1':20 'auth':3,9,48,61,69 'authent':32,62 'backend':15 'better':68 'better-auth':67 'cadenc':51 'cloudflar':17,39,71 'current':23 'd1':18,42,70 'databas':43 'decentr':13 'design':11 'develop':59 'differenti':36 'earli':58 'general':46 'general-purpos':45 'javascript':60 'learn':2 'learn-auth-sdk':1 'librari':49 'multi':29,65 'multi-ten':28,64 'offer':27 'open':7 'open-sourc':6 'purpos':47 'rapid':53 'rbac':31,63 'releas':25,50 'sdk':4,10 'sourc':8 'stabl':24 'support':35 'target':38 'tenant':14,30,66 'typescript':34,72 'unlik':44 'use':16 'version':19 'worker':40","created_at":"2026-06-04T18:52:10.318645+00:00","updated_at":"2026-06-04T18:52:10.318645+00:00","problems":[{"fix":"Install the package: npm install learn-auth-sdk. Ensure tsconfig.json includes 'node_modules' in 'paths' or use 'moduleResolution': 'node'.","cause":"Package not installed or TypeScript not configured to resolve module.","error":"Cannot find module 'learn-auth-sdk' or its corresponding type declarations."},{"fix":"Ensure you import all necessary symbols: import { LearnAuth } from 'learn-auth-sdk' and not a subpath.","cause":"Circular dependency or missing import of a required submodule.","error":"TypeError: Class extends value undefined is not a constructor or null"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/carsontkempf/learn/tree/main/packages/auth-sdk","github":"https://github.com/carsontkempf/learn","docs":null,"changelog":null,"pypi":null,"npm":"learn-auth-sdk","openapi_spec":null,"status_page":null,"smithery":null,"categories":["security","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}