nuxt-supabase-query
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Nuxt Supabase Query

npm version npm downloads License Nuxt

A useAsyncData-like solution for Supabase select queries

Features

  • [x] Simpler API for cleaner code
  • [x] Written on top of Postgrest-JS
  • [x] Allow passing filters as a computed function, so re-fetching can occur if the query changes
  • [x] Shared results from SSR for Hydration across instances
  • [X] Support "count" as ref returned next to data
  • [ ] Work with custom schemas
  • [ ] Support useAsyncData options such as server, immediate, and watch
  • [ ] Fully typed, including errors (since errors should always be Postgrest Errors)
  • [ ] Offer an abstraction around range() for infinite scroll style loading

Quick Setup

Install the module to your Nuxt application with one command:

npx nuxi module add nuxt-supabase-query

That's it! You can now use Nuxt Supabase Query in your Nuxt app ✨

Demo

Usage with Nuxt Supabase Module

const supabase = useSupabaseClient()
const { data, count, error, status } = await useSupabaseQuery(
  supabase,
  'table',
  '*',
  filter => filter.eq('id', 'example'),
  {count: 'exact', single: false}
)

Usage with Supabase-JS

import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
const { data, count, error, status } = await useSupabaseQuery(
  supabase,
  'table',
  '*',
  filter => filter.eq('id', 'example'),
  {count: 'exact', single: false}
)

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-supabase-query

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

11.2 kB

Total Files

11

Last publish

Collaborators

  • dan-hale