Back to articles
Lucia Auth Has a Free API — Lightweight Session-Based Authentication

Lucia Auth Has a Free API — Lightweight Session-Based Authentication

via Dev.to WebdevAlex Spinov

Lucia is a lightweight auth library that handles sessions and cookies. No magic, no opinions — just clean session management you understand and control. Why Lucia? Simple — ~200 lines of core code, easy to understand Session-based — secure cookies, not JWTs Any database — bring your own adapter Any framework — Next.js, SvelteKit, Astro, Express Quick Start npm install lucia oslo @lucia-auth/adapter-drizzle import { Lucia } from ' lucia ' ; import { DrizzlePostgreSQLAdapter } from ' @lucia-auth/adapter-drizzle ' ; const adapter = new DrizzlePostgreSQLAdapter ( db , sessionTable , userTable ); export const lucia = new Lucia ( adapter , { sessionCookie : { attributes : { secure : process . env . NODE_ENV === ' production ' , }, }, getUserAttributes : ( attributes ) => ({ email : attributes . email , name : attributes . name , }), }); Sign Up import { generateId } from ' lucia ' ; import { Argon2id } from ' oslo/password ' ; async function signUp ( email : string , password : string , name

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles