A database is required for storing your users and sessions. Lucia connects to your database via an adapter, which provides a set of basic, standardized querying methods that Lucia can use.

import { Lucia } from "lucia";
import { BetterSqlite3Adapter } from "@lucia-auth/adapter-sqlite";

const lucia = new Lucia(new BetterSqlite3Adapter(db));

See Adapter for building your own adapters.

Database setup

Refer to these guides on setting up your database, ORMs, and query builders:

Community-maintained database adapters

These adapters are not routinely checked by the maintainers of Lucia. Make sure to check the source code and use them at your own risk!