Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 5 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-20T05:45:02.000Z (12 days ago)
- Last Synced: 2025-01-20T13:15:22.538Z (12 days 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.92 MB
- Stars: 3,388
- Watchers: 48
- Forks: 291
- Open Issues: 154
-
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/## 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),
},
})
```## Sponsors
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)
## Badges
[![Coverage Status](https://coveralls.io/repos/github/supabase/supabase-js/badge.svg?branch=master)](https://coveralls.io/github/supabase/supabase-js?branch=master)