Ctrl K
ComunidadGuías…
GITHUB · ANALIZADO

loginbase

Self-hosted login foundation for Cloudflare Workers supporting email OTP, social OAuth (GitHub), session management, with a Kotlin Multiplatform client.

Ficha actualizada 23 sept 2026, 3:28 · upstream 23 sept 2026, 3:06 · release 2.1.0

Ver códigoProblemas y ayudaRepositorio ↗
00

Qué es loginbase

Descripción editorial construida a partir del repositorio, su documentación y sus señales de mantenimiento.

loginbase is a self-hosted authentication foundation designed to run inside Cloudflare Workers. It eliminates the need for external account servers or vendor dashboards by storing users, sessions, and login events directly in your own D1 database. The library provides passwordless sign-in with six-digit email codes, three layers of rate limiting, GitHub OAuth integration, and account linking. A Kotlin Multiplatform client (loginbase-kt) implements the remaining half of the authentication flow.

The architecture is intentionally minimal: no central auth server, no vendor dashboard, no migration projects when pricing changes. Instead, loginbase mounts into an existing Worker with your own D1 database, giving you full ownership over user data and session state. This removes the latency and security risks associated with redirecting users to external providers for verification.

The library also includes built-in analytics that track every authentication event—sign-ins, verifications, refreshes, revocations—with geographic context from Cloudflare's request.cf. These events land in a shared `auth_events` table alongside your client-side analytics, enabling funnel analysis without leaving your account. The design prioritizes developer experience: no token handling in app code, automatic session recovery on flaky network conditions, and silent failure modes that don't break tests.

Key features include six-digit email codes with enumeration-safe responses to prevent brute-force attacks, optional demo accounts for App Store review compliance without authentication bypasses, and a refresh token rotation mechanism that kills sessions on replay attempts. The system supports multiple sign-in providers (email, GitHub) while keeping the core logic contained within your own infrastructure.

CASOS DE USO
  • Email-based passwordless authentication with six-digit codes for Cloudflare Workers
  • GitHub OAuth integration allowing social login without external identity providers
  • Session management and refresh token rotation inside a single Worker deployment
  • Analytics tracking of all auth events (sign-in, verify, refresh, revoke) in a shared D1 table
  • Multi-provider authentication with email codes and GitHub OAuth on the same infrastructure
PUNTOS DESTACADOS
  • Runs entirely within Cloudflare Workers using only your own D1 database—no external account server or vendor dashboard required
  • Email OTP with six-digit codes, three layers of rate limiting, and enumeration-safe responses to prevent brute-force attacks
  • GitHub OAuth integration that allows social sign-in without needing an external identity provider
  • Kotlin Multiplatform client (loginbase-kt) handles the remaining authentication logic including refresh token rotation and session management
  • Built-in analytics tracking every auth event with geographic context from Cloudflare's request.cf, shared between server and client code
PRECAUCIONES
  • Does not support password-based login or OIDC/SAML providers — only email codes and GitHub OAuth are supported
  • No multi-tenancy support; all users share the same D1 database unless you implement your own partitioning strategy
  • Email delivery depends on Resend's service, which may have rate limits or delivery failures that aren't handled at the library level
  • The refresh token rotation mechanism only handles replay attacks and does not provide additional protection against credential stuffing
  • No user profile storage — your `onVerified` handler must maintain all user data including preferences and settings
01

Perfil de infraestructura

Estimación inicial derivada del repositorio y de los servicios detectados.

CPU1 vCPUrecomendación inicial
MEMORIA1 GBRAM estimada
DISCO10 GBalmacenamiento base
COMPLEJIDADlownivel de operación
02

Despliegue detectado

Qué señales reales de instalación hemos encontrado.

Despliegue manual

Deploy to Cloudflare Workers by creating a D1 database with the appropriate bindings (DB for queries, EMAIL_CODES for email codes). Apply migrations from node_modules/loginbase/migrations/ into your own directory. Configure `wrangler.toml` to point to your D1 and KV databases. For GitHub OAuth, configure your app's redirect URI in loginbase-kt and provide the client credentials. The zone must have no cache rules that make third-party subrequests cacheable — otherwise cross-account sign-in will fail silently. Use Hono as a peer dependency for routing; if you already use it, keep the single copy to avoid version conflicts.

—Dockerfile
—Compose
—One-click
03

Stack y dependencias

Componentes inferidos a partir de manifests, configuración y documentación.

FRAMEWORKS
Next.js
SERVICIOS
No detectados
BASES DE DATOS
No detectadas
PUERTOS
No detectados
05

Puede sustituir a

Relaciones detectadas por el análisis del repositorio y su categoría.

06

Experiencia real de la comunidad

Ayuda a contrastar la estimación automática con instalaciones reales.

Todavía no hay datos comunitarios para este proyecto.