Dash
Add personal activity and organization audit logs to Solid and Zaidan settings.
The Dash integration adds Activity tabs to personal settings, organization settings, and the Admin user inspector. It reads audit logs through the public dashClient() API from @better-auth/infra.
Organization owners and admins see organization-wide activity. Other members see only their own activity in that organization. Every organization query uses the organization ID from the current route.
Setup
Configure Dash on the server
Install @better-auth/infra, then add dash() to Better Auth. Dash records supported authentication and organization events automatically.
import { dash } from "@better-auth/infra"
import { betterAuth } from "better-auth"
export const auth = betterAuth({
plugins: [
dash({
apiUrl: process.env.BETTER_AUTH_API_URL,
kvUrl: process.env.BETTER_AUTH_KV_URL,
apiKey: process.env.BETTER_AUTH_API_KEY
})
]
})See the Dash plugin guide for infrastructure setup and available events.
Add the client plugin
import { dashClient } from "@better-auth/infra/client"
import { createAuthClient } from "better-auth/client"
import { organizationClient } from "better-auth/client/plugins"
export const authClient = createAuthClient({
plugins: [organizationClient(), dashClient()]
})Install the UI plugin
bunx shadcn@latest add https://better-auth-ui.com/r/solid/dash.jsonRegister the UI plugin
import { AuthProvider } from "@/components/auth/auth-provider"
import { dashPlugin } from "@/lib/auth/dash-plugin"
import { organizationPlugin } from "@/lib/auth/organization-plugin"
export function Providers(props: { children?: JSX.Element }) {
return (
<AuthProvider
authClient={authClient}
navigate={navigate}
plugins={[organizationPlugin(), dashPlugin()]}
>
{props.children}
</AuthProvider>
)
}Both personal and organization activity are enabled by default. Set organization: false if the app does not use Better Auth organizations.
Static routes
The plugin adds one static path named activity. Its default segment is activity, which produces routes such as /settings/activity and the matching organization activity path.
It does not use query parameters, nested plugin routes, or a catch-all route. Add the segment to both static path lists when the application validates or generates settings and organization routes.
import { viewPaths } from "@better-auth-ui/core"
import { dashPlugin } from "@/lib/auth/dash-plugin"
import { organizationPlugin } from "@/lib/auth/organization-plugin"
const activityPath = dashPlugin({ path: "activity" }).viewPaths.settings.activity
export const validSettingsPaths = [
...Object.values(viewPaths.settings),
...Object.values(organizationPlugin().viewPaths.settings ?? {}),
activityPath
]
export const validOrganizationPaths = [
...Object.values(organizationPlugin().viewPaths.organization ?? {}),
activityPath
]Use the same Dash options in the provider and route configuration when you customize the segment.
Admin user activity
If the Admin integration is present, Dash adds an Activity tab to its user inspector. The tab calls getAllAuditLogs({ userId }) for the selected user.
Dash authorizes this endpoint for organization owners and admins. A Better Auth application-admin role does not grant Dash access by itself.
Set admin: false on dashPlugin() to remove this inspector tab.
Access and privacy
- Personal settings call
getAuditLogsfor the signed-in user. - Organization settings check the member role for the explicit organization ID.
- Owners and admins call
getAllAuditLogsfor that organization. - Other members call
getAuditLogswith the organization filter. - IP addresses are hidden by default. Set
showIpAddress: trueonly when your privacy policy permits it.
Retention comes from Dash
The empty state says that no retained activity matches the view. It does not claim that an event never occurred.
Headless hooks
import {
useDashAllAuditLogs,
useDashAuditLogs,
useDashUserAuditLogs
} from "@better-auth-ui/solid/plugins/dash"The core package also exports query option factories and ensure, prefetch, and fetch helpers from @better-auth-ui/core/plugins/dash.
Runtime prerequisites
- Server:
dash()from@better-auth/infra. - Client:
dashClient()from@better-auth/infra/client. - Organization activity: the Better Auth organization server and client plugins.
- Runtime API: Dash hooks and query helpers from the Solid package.
Copied files
src/lib/auth/dash-plugin.tsxsrc/components/auth/dash/activity.tsx
Options
Prop
Type
Localization
Prop
Type
Last updated on