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
Your Better Auth instance. This is the configured auth object from Better Auth.
Base path for the Studio UI routes. Default: /api/studio
Access control configuration for Studio. Controls who can access the Studio UI. See StudioAccessConfig for details.
Studio customization and branding metadata including title, logo, theme, and feature toggles. See StudioMetadata for details.
Configuration for last-seen tracking. When enabled, Studio tracks when users were last active. Show StudioLastSeenAtConfig fields
Enable last-seen tracking. Default: false
Column/field name in your user table (e.g., “lastSeenAt”, “last_seen_at”). Default: "lastSeenAt"Note: The column must exist in your user table. No plugin or additionalFields needed in Better Auth config - Studio injects the field into the user schema and updates it on sign-in/sign-up.
IP geolocation configuration. When set, Studio uses this for Events and Sessions IP resolution. IPInfo Provider: {
provider : "ipinfo" ;
apiToken ?: string ;
baseUrl ?: string ;
endpoint ?: "lite" | "lookup" ; // Default: "lookup"
}
endpoint: “lite” for free tier (country/continent only), “lookup” for core/plus (city/region)
IPApi Provider: {
provider : "ipapi" ;
apiToken ?: string ;
baseUrl ?: string ;
}
Static (MaxMind) Provider: {
provider : "static" ;
path : string ; // Required: path to .mmdb file
}
Use a local MaxMind GeoLite2 (.mmdb) file
path: Absolute or relative path from your project (e.g., ”./data/GeoLite2-City.mmdb”)
Tools list configuration. When self-hosting, use exclude to hide tools from the UI (e.g., in production). Default: All tools are includedArray of tool IDs to exclude from the Tools page. Available tool IDs:
"test-oauth"
"hash-password"
"run-migration"
"test-db"
"validate-config"
"health-check"
"export-data"
"jwt-decoder"
"token-generator"
"plugin-generator"
"uuid-generator"
"password-strength"
"oauth-credentials"
"secret-generator"
Example: tools : {
exclude : [ 'test-oauth' , 'health-check' ]
}
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" ,
},
});