DEV Community

Alex Spinov
Alex Spinov

Posted on

Lucia Has a Free Auth Library — Simple Authentication Without Auth-as-a-Service

A developer evaluated Auth0 ($23/month for 1,000 users), Clerk ($25/month), and Firebase Auth (free but vendor-locked). For a side project with 50 users, all felt like overkill.

Lucia is a free, lightweight auth library. Session-based authentication that YOU control. No external service, no vendor lock-in, no surprise pricing.

What Lucia Offers for Free

  • Session Management - Secure cookie-based sessions
  • Database Agnostic - Works with any database (Prisma, Drizzle, raw SQL)
  • Framework Agnostic - Next.js, SvelteKit, Astro, Express, Hono
  • OAuth - GitHub, Google, Discord, any OIDC provider
  • Password Hashing - Built-in Argon2id/bcrypt
  • Two-Factor - TOTP support for 2FA
  • TypeScript - Full type safety
  • Lightweight - No bloat, no magic, just functions

Quick Example

import { Lucia } from 'lucia'
import { PrismaAdapter } from '@lucia-auth/adapter-prisma'

const lucia = new Lucia(new PrismaAdapter(prisma.session, prisma.user))

// Create session
const session = await lucia.createSession(userId, {})
const cookie = lucia.createSessionCookie(session.id)
Enter fullscreen mode Exit fullscreen mode

GitHub: lucia-auth/lucia - 10K+ stars


Need to monitor and scrape data from multiple web services automatically? I build custom scraping solutions. Check out my web scraping toolkit or email me at spinov001@gmail.com for a tailored solution.

Top comments (0)