Skip to main content

Overview

The StudioConfig type is the main configuration object for Better Auth Studio. It defines all available settings including authentication, access control, metadata, events, and more.

Type Definition

export type StudioConfig = {
  auth: any;
  basePath?: string;
  access?: StudioAccessConfig;
  metadata?: StudioMetadata;
  lastSeenAt?: StudioLastSeenAtConfig;
  ipAddress?: StudioIpAddressConfig;
  tools?: {
    exclude?: StudioToolId[];
  };
  events?: {
    enabled?: boolean;
    tableName?: string;
    provider?: EventIngestionProvider;
    client?: any;
    clientType?: "postgres" | "prisma" | "drizzle" | "clickhouse" | "https" | "custom" | "sqlite" | "node-sqlite";
    include?: AuthEventType[];
    exclude?: AuthEventType[];
    batchSize?: number;
    flushInterval?: number;
    retryOnError?: boolean;
    liveMarquee?: LiveMarqueeConfig;
    onEventIngest?: (event: AuthEvent) => void | Promise<void>;
  };
};

Fields

auth
any
required
Your Better Auth instance. This is the configured auth object from Better Auth.
basePath
string
Base path for the Studio UI routes.Default: /api/studio
access
StudioAccessConfig
Access control configuration for Studio. Controls who can access the Studio UI.See StudioAccessConfig for details.
metadata
StudioMetadata
Studio customization and branding metadata including title, logo, theme, and feature toggles.See StudioMetadata for details.
lastSeenAt
StudioLastSeenAtConfig
Configuration for last-seen tracking. When enabled, Studio tracks when users were last active.
ipAddress
StudioIpAddressConfig
IP geolocation configuration. When set, Studio uses this for Events and Sessions IP resolution.
tools
object
Tools list configuration. When self-hosting, use exclude to hide tools from the UI (e.g., in production).Default: All tools are included
events
object
Events tracking and ingestion configuration. Controls how authentication events are captured and stored.See Events Configuration for full details.

Helper Function

export function defineStudioConfig(config: StudioConfig): StudioConfig
Helper function to define Studio configuration with type safety and autocomplete. Example:
import { defineStudioConfig } from "better-auth-studio";
import { auth } from "./auth";

export const studioConfig = defineStudioConfig({
  auth,
  basePath: "/api/studio",
  access: {
    roles: ["admin"],
  },
  metadata: {
    title: "My App Studio",
    theme: "dark",
  },
  events: {
    enabled: true,
    tableName: "auth_events",
  },
});

Build docs developers (and LLMs) love