Lucia-Auth

A simple and flexible user and session management library that provides an ...

README

Lucia


Lucia is a simple and flexible user and session management library that provides an
abstraction layer between your app and your database. It's bare-bones by design, keeping
everything easy to use and understand. Get started by reading the introduction page.

Code sample


Working with Lucia looks something like this. In the code below, you're creating a new user with a email/password method, creating a new session, and creating a cookie that you can set it to the user.

  1. ```ts
  2. const user = await auth.createUser({
  3. primaryKey: {
  4.   providerId: "email",
  5.   providerUserId: email,
  6.   password
  7. },
  8. attributes: {
  9.   email,
  10.   username
  11. }
  12. });
  13. const session = await auth.createSession(user.userId);
  14. const sessionCookie = auth.createSessionCookie(session);
  15. ```

Resources






Installation


  1. ```
  2. npm i lucia-auth
  3. pnpm add lucia-auth
  4. yarn add lucia-auth
  5. ```

Attributions


This project would not have been possible without our contributors, thank you!

Logo by @dawidmachon, licensed under CC BY-NC-SA 4.0.