Upstash Redis adapter

Session adapter for Upstash Redis provided by the Redis session adapter package. This only handles sessions, and not users or keys.

import { upstash } from "@lucia-auth/adapter-session-redis";
const upstash: (
	upstashClient: Redis,
	prefixes?: {
		session: string;
		userSessions: string;
) => InitializeAdapter<SessionAdapter>;
upstashClientRedisServerless redis client for upstash.
prefixesRecord<string, string>Key prefixes

Key prefixes#

Key are defined as a combination of a prefix and an id so everything can be stored in a single Redis instance. By default, sessions are stored as session:<session_id> and user-sessions relationships are stored as user_sessions:<user_id>.


import { lucia } from "lucia";
import { upstash } from "@lucia-auth/adapter-session-redis";
import { Redis } from "@upstash/redis";

const upstashClient = new Redis({
	// ...

const auth = lucia({
	adapter: {
		user: userAdapter, // any normal adapter for storing users/keys
		session: upstash(upstashClient)
	// ...