Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built a Supabase-style query client that talks directly to Postgres

Описание и применение

pg-fluent позволяет использовать API Supabase напрямую с PostgreSQL, избавляя от PostgREST и HTTP‑запросов, сохраняя при этом все возможности и типизацию.

Задача

Developers using Supabase JS client want to avoid the overhead of a PostgREST service and the need for a project URL and anon key when they already control a Postgres instance.

Результат

pg-fluent provides a Supabase‑style query API that runs directly against PostgreSQL, removing the need for a PostgREST service and HTTP requests while retaining all query features, type safety, and optional tracing.

Рабочий процесс

  • Install pg-fluent via npm
  • Create a client with createClient({connectionString: process.env.DATABASE_URL})
  • Use the Supabase-like API: db.from('table').select(...).eq(...).order(...).limit(...)
  • Optionally inspect generated SQL with toSQL()
  • Perform transactions with db.transaction(trx => { ... })
  • Execute raw SQL safely with db.sql...
  • Stream rows, use COPY, LISTEN/NOTIFY, or read replicas with .primary()
  • Generate TypeScript types with npx pg-fluent gen-types

Доказательства

pg-fluent uses the real @supabase/postgrest-js and hands it a custom fetch.

Источник

The whole postgrest-js surface works: filters, or()/not()/filter(), JSON paths like meta->>author, range(), single()/maybeSingle(), count, upsert, rpc, csv(), explain(), and embeds.

Источник

The tagged template always binds interpolations as parameters. The only way to run SQL text you built yourself is db.unsafe().

Источник

  • Дата записи: 2026-10-14T21:56:20.356Z