https://github.com/supabase/supabase-js
An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://github.com/supabase/supabase-js
client-library database isomorphic javascript js mit-license node-js nuxt orm postgres postgresql postgrest supabase svelte ts typescript
Last synced: 26 days ago
JSON representation
An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
- Host: GitHub
- URL: https://github.com/supabase/supabase-js
- Owner: supabase
- License: mit
- Created: 2020-05-15T12:52:16.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-25T11:17:51.000Z (about 1 month ago)
- Last Synced: 2025-04-29T18:26:09.957Z (about 1 month ago)
- Topics: client-library, database, isomorphic, javascript, js, mit-license, node-js, nuxt, orm, postgres, postgresql, postgrest, supabase, svelte, ts, typescript
- Language: TypeScript
- Homepage: https://supabase.com
- Size: 4.98 MB
- Stars: 3,623
- Watchers: 56
- Forks: 336
- Open Issues: 171
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `supabase-js` - Isomorphic JavaScript Client for Supabase.
- **Documentation:** https://supabase.com/docs/reference/javascript/start
- TypeDoc: https://supabase.github.io/supabase-js/v2/> [!NOTE]
> Do you want to help us shape the future of this library? [We're hiring](https://jobs.ashbyhq.com/supabase/85d07345-47c6-4980-82e2-57782f83ab4e).## Usage
First of all, you need to install the library:
```sh
npm install @supabase/supabase-js
```Then you're able to import the library and establish the connection with the database:
```js
import { createClient } from '@supabase/supabase-js'// Create a single supabase client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
```### UMD
You can use plain ``s to import supabase-js from CDNs, like:
```html
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2">
```or even:
```html
```
Then you can use it from a global `supabase` variable:
```html
const { createClient } = supabase
const _supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')console.log('Supabase Instance: ', _supabase)
// ...```
### ESM
You can use `` to import supabase-js from CDNs, like:
```html
<script type="module">
import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm'
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')console.log('Supabase Instance: ', supabase)
// ...```
### Deno
You can use supabase-js in the Deno runtime via [JSR](https://jsr.io/@supabase/supabase-js):
```js
import { createClient } from 'jsr:@supabase/supabase-js@2'
```### Custom `fetch` implementation
`supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:
```js
import { createClient } from '@supabase/supabase-js'// Provide a custom `fetch` implementation as an option
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {
global: {
fetch: (...args) => fetch(...args),
},
})
```## Badges
[](https://coveralls.io/github/supabase/supabase-js?branch=master)