nuxt-postgrest
v0.0.4
Published
First-class PostgREST for Nuxt: typed clients, SSR-aware composables and auth-aware JWT forwarding. No Supabase required.
Maintainers
Readme
nuxt-postgrest
First-class PostgREST for Nuxt: typed clients, SSR-aware composables, and auth-aware JWT forwarding. Built on @supabase/postgrest-js — no Supabase account or hosting required.
📖 Documentation · 🐛 Report a bug
Features
- 🔒 Forwards the logged-in user's JWT so Postgres row-level security applies
- 🧠 Fully typed from your generated
Databasetype — tables, columns and schemas checked at compile time - 🌐 One client for components, pages and Nitro server routes, SSR included
- 🔑 Reads sessions from
nuxt-auth-utilsautomatically, or pass any JWT - 🗂️ Switch Postgres schemas or build per-tenant clients on demand
- 🪶 A thin layer over the battle-tested
postgrest-jsquery builder — nothing new to learn
Quick start
npx nuxi module add nuxt-postgrest// nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-postgrest'],
postgrest: { url: 'http://localhost:3001' },
})<script setup lang="ts">
const { data } = await useAsyncData('todos', async () => {
const { data, error } = await usePostgrest().from('todos').select('*')
if (error) throw error
return data
})
</script>See the full documentation for configuration, authentication, type generation and the server-side usePostgrestUser / usePostgrestAdmin composables.
Development
git clone https://github.com/kiansa/nuxt-postgrest
cd nuxt-postgrest
pnpm install
pnpm db:up # Postgres + PostgREST on :5432 / :3001
pnpm dev # playground at http://localhost:3000
pnpm test # unit + e2e against the local PostgRESTSee CONTRIBUTING.md for the full workflow.
