Aurabase Logo
aurabasedocs
docs›JavaScript SDK reference›Client and services

Client and services

The entry point of the SDK: how to create the client and which services it exposes.

6 min read·Level reference·Revised on Oct 12, 2026
This English text was generated automatically from the French original and has not been reviewed yet.
#
Functions

Exported functions

FunctionDescription
function createClient<Database = any>(baseUrl: string, apiKey: string, options?: AuraClientOptions): AuraClient<Database>Create a new Aurabase client instance.
function createAdminClient<Database = any>(baseUrl: string, serviceRoleKey: string, options?: AuraClientOptions): AuraClient<Database>Creates a client for SERVER use only for administration operations (client.authAdmin: list/create/ban users, read audit).
#
Class

AuraClient

Main Aurabase client.

PropertyDescription
readonly baseUrl: stringProject URL (https://<slug>.aurabase.cloud), without trailing bar.
readonly apiKey: string | nullProject API key (anon or service_role) sent in the apikey header; null if none was provided.
readonly fetchFn: typeof globalThis.fetchFunction fetch used for all queries (that of options.fetch, otherwise globalThis.fetch).
readonly authStore: BaseAuthStoreSession store (access token, refresh token, user): memory, localStorage or cookies depending on context.
readonly retryConfig: { enabled: boolean; maxRetries: number; }Read request resumption policy (GET, HEAD) on transient error: enabled or not, and maximum number of resumptions.
readonly requestTimeoutMs?: numberDefault timeout (ms) for JSON requests without signal. undefined → core fault (30s).
readonly onEvent?: (event: AuraObservabilityEvent) => voidObservability hook — see AuraClientOptions.onEvent.
readonly debug?: booleanJournalise chaque AuraObservabilityEvent via console.debug — voir AuraClientOptions.debug.
get auth(): AuthServiceAuthentication service: registration, connection, session, MFA, OAuth, identities.
get authAdmin(): AuthAdminServiceAuthentication administration API (users, sessions, audit log, email templates).
get db(): DatabaseService<Database, Schema>Database service: queries on tables and views, SQL function calls (rpc), raw SQL.
get storage(): StorageServiceStorage service: buckets, sending, downloading, signed and public URLs, image transformations.
get realtime(): RealtimeServiceReal-time service: channels, Postgres changes, broadcast (broadcast) and presence.
get functions(): FunctionsServiceEdge Functions service: invocation, and management of jobs and cron with a service_role key.
get ai(): AiServiceAI service: conversation (chat), embeddings, RAG (ingest, queries, namespaces), semantic search and sessions.
get notifications(): NotificationsServiceNotifications service: sending (email, SMS, push, webhook), history, templates and administration.
MethodDescription
dispose(): voidDismounts the client: stops proactive refresh (ticker + visibility + BroadcastChannel), disconnects realtime, empties auth listeners.
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(table: TableName): AuraQueryBuilder<Schema, Table, TableName, AuraClientOptionsT>
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(view: ViewName): AuraQueryBuilder<Schema, View, ViewName, AuraClientOptionsT>
from(table: string): AuraQueryBuilder<any, any, any, AuraClientOptionsT>
Shortcut: query a database table or view (Supabase-compatible API).
rpc<FnName extends string = string, Args extends Record<string, unknown> = Record<string, unknown>>(fn: FnName, args?: Args, options?: Parameters<DatabaseService<Database, Schema>['rpc']>[2]): ReturnType<DatabaseService<Database, Schema>['rpc']>Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
channel(name: string, options?: ChannelConfig): AuraChannelShortcut: create a realtime channel with Supabase-compatible API.
removeChannel(channel: string | AuraChannel): voidShortcut: remove a realtime channel by name or AuraChannel instance.
removeAllChannels(): voidShortcut: remove all realtime channels and unsubscribe.
getChannels(): AuraChannel[]Shortcut: list all active realtime channels.
Generated page

This page is generated from the type declarations and comments of the SDK, so it cannot drift from the published code. For worked examples, read the guides.

Last updated · Oct 12, 2026