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

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

说明与用途

pg-fluent 让开发者使用 Supabase 查询 API 直接连接 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