JavaScript SDK
@aurabase/aurabase-js — typed client for Node, Bun, Deno, Next.js, React, SvelteKit, Vue. Covers Database, Auth, Realtime, Storage, Functions.
One package, four managers
The SDK directly includes @aurabase/aurabase-js/ssr export for Next.js (App Router, Server Actions, Middleware), Remix, Nuxt and SvelteKit with automatic management of session cookies and anti-truncation chunking.
Create the client
Native Server-Side Rendering support
For SSR architectures (Next.js App Router, Middleware, Server Actions, SvelteKit), import createServerClient from @aurabase/aurabase-js/ssr. The user session is automatically stored in secure httpOnly cookies, with multi-chunk support for large tokens:
Codegen from your schema
aura db generate (or npx @aurabase/gen) generates a aurabase.types.ts file from your complete schema (tables, views, enums, RPC functions). To plug into createClient<Database> to type all of your queries.
By service
Database
SignatureReturn
.from(table).select(cols?)``SelectBuilder<T>
.from(table).insert(row)``Promise<{ data, error }>
.from(table).update(patch)``UpdateBuilder<T>
.from(table).delete()``DeleteBuilder<T>
.rpc(fn, args)``Promise<{ data, error }>
Auth
SignatureReturn
.auth.signUp({ email, password })``Promise<AuthResponse>
.auth.signInWithPassword({ ... })``Promise<AuthResponse>
.auth.signInWithOAuth({ provider })``Promise<{ url }>
.auth.getSession()``Promise<Session | null>
.auth.signOut()``Promise<void>
.auth.mfa.enroll({ factor_type })``Promise<Factor>
Realtime
SignatureReturn
.channel(name, config?)``Channel
channel.on(event, filter, cb)``Channel
channel.subscribe()``Channel
channel.send({ type, event, payload })``Promise<void>
channel.unsubscribe()``Promise<void>
Storage
SignatureReturn
.storage.from(bucket).upload(path, file, opts?)``Promise<{ data, error }>
.storage.from(bucket).download(path)``Promise<Blob>
.storage.from(bucket).getPublicUrl(path, opts?)``{ publicUrl }
.storage.from(bucket).createSignedUrl(path, expiresIn)``Promise<{ signedUrl }>
.storage.from(bucket).remove(paths[])``Promise<{ data, error }>
Functions
SignatureReturn
.functions.invoke(name, { body?, method?, path?, headers?, responseType?, signal?, timeout? })``Promise<{ data, error }>
.functions.list()``Promise<{ data: FunctionDef[], error }>
.functions.get(nameOrId)``Promise<{ data: FunctionDef, error }>
.functions.listJobs({ status?, limit? })``Promise<{ data: Job[], error }>
.functions.getJob(jobId)``Promise<{ data: Job, error }>
.functions.listCronJobs()``Promise<{ data: CronJob[], error }>
.functions.createCronJob(name, schedule, functionName, { payload? })``Promise<{ data: CronJob, error }>
.functions.deleteCronJob(name)``Promise<{ data, error }>
Uniform shape { data, error }
Each async method returns { data, error }. error is null on success, otherwise an object with code, message, details.