← Back to archive

Repo of the Day

supabase/supabase-js

Published: Dec 6, 2022

Open repository ↗

An isomorphic Javascript client for Supabase.

Summary

supabase-js is the official TypeScript/JavaScript client library for Supabase, packaged as a monorepo that bundles several smaller SDKs. The main package, @supabase/supabase-js, provides a single isomorphic client for talking to a Supabase backend, while sub-packages expose auth, PostgREST, realtime, storage, and edge functions independently.

What it is useful for

This library is the entry point for any JavaScript or TypeScript application that needs to interact with a Supabase project. The main supabase-js package combines the other SDKs into one client object, so you can query a Postgres database, sign users in, subscribe to row-level changes over WebSockets, upload and download files, and call server-side functions without wiring up each protocol by hand. The individual sub-packages (postgrest-js, auth-js, realtime-js, storage-js, functions-js) are useful when you only need one capability, or when you are building a custom integration rather than a full Supabase app.

It also covers a wide range of runtimes. The README documents support for Node.js (Active LTS and Maintenance only), Deno (stable and lts channels), modern browsers, Bun, React Native, and Cloudflare Workers. Because the codebase is TypeScript-first, you get type information for query results and database schema.

How engineers can use it

The documented quick start is one install:

npm install @supabase/supabase-js

You then construct a client with your project URL and anon key, and use the returned object for database queries, auth flows, storage, realtime channels, and function invocations. Per-package READMEs under packages/core/* cover the individual APIs in more detail.

A few constraints worth knowing before adopting it:

  • Node.js 18 support was dropped in version 2.79.0, and Node.js 20 was dropped in 2.110.0. The README directs users pinned to those runtimes to versions 2.78.0 and 2.109.0 respectively.
  • Realtime in browsers requires a WebSocket-capable environment; modern browsers with native fetch are otherwise fine.
  • Features marked experimental in the SDKs may change or be removed without notice.
  • UNUSED_EXTERNAL_IMPORT warnings from Vite or Nuxt are documented as false positives.

For contributors, the repo uses pnpm workspaces with Nx, follows conventional commits, and runs tests per package via pnpm nx affected --target=test. A broader testing overview lives in docs/TESTING.md. The library is released under the MIT License.