
Security News
White House Authorizes Private Companies to Conduct Offensive Cyber Operations
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.
@supabase/postgrest-js
Advanced tools
Guides · Reference Docs · TypeDoc
Install
npm install @supabase/postgrest-js
Usage
import { PostgrestClient } from '@supabase/postgrest-js'
const REST_URL = 'http://localhost:3000'
const postgrest = new PostgrestClient(REST_URL)
fetch implementationpostgrest-js uses the runtime's global fetch to make HTTP requests, but an alternative fetch implementation can be provided as an option. This is useful in environments where the global fetch is unavailable or where you want to customize request behavior:
import { PostgrestClient } from '@supabase/postgrest-js'
const REST_URL = 'http://localhost:3000'
const postgrest = new PostgrestClient(REST_URL, {
fetch: (...args) => fetch(...args),
})
This package is part of the Supabase JavaScript monorepo. To work on this package:
# Build (from monorepo root)
pnpm nx build postgrest-js
# Build with watch mode for development
pnpm nx build:watch postgrest-js
# TypeScript type checking
pnpm nx type-check postgrest-js
# Generate documentation
pnpm nx docs postgrest-js
Supabase CLI Required! The postgrest-js tests use the Supabase CLI to run a local PostgreSQL database and PostgREST server.
# Run all tests (from monorepo root)
pnpm nx test:ci:postgrest postgrest-js
This single command automatically:
# Run Jest tests with coverage (requires infrastructure running)
pnpm nx test:run postgrest-js
# Run type tests with tstyche
pnpm nx test:types postgrest-js
# Run smoke tests (CommonJS and ESM imports)
pnpm nx test:smoke postgrest-js
# Format code
pnpm nx format postgrest-js
# Check formatting
pnpm nx format:check postgrest-js
The tests use Supabase CLI to spin up:
# Manually manage test infrastructure (from monorepo root)
pnpm nx test:infra postgrest-js # Start containers
pnpm nx test:clean-pre postgrest-js # Stop and remove containers
Or directly via Supabase CLI:
cd packages/core/postgrest-js
npx supabase --workdir ./test start # Start all services
npx supabase --workdir ./test db reset # Reset and seed database
npx supabase --workdir ./test stop # Stop all services
When the database schema changes, regenerate TypeScript types from the actual database:
# From the monorepo root
pnpm run codegen:postgrest
This command automatically:
The generated types are written to test/types.generated.ts.
pnpm nx test:run postgrest-js)pnpm nx test:types postgrest-js)pnpm nx test:smoke postgrest-js)npx (npx supabase)We maintain backward compatibility tests for PostgREST v12 (the current Supabase CLI uses v14+). These tests ensure the SDK works correctly for users still running older PostgREST versions.
# Run v12 compatibility tests (requires Docker)
pnpm nx test:ci:v12 postgrest-js
This command:
Type-only tests for v12 compatibility also run as part of the regular type tests:
pnpm nx test:types postgrest-js # Includes v12-compat.test-d.ts
Note: These v12 tests will be removed when v3 ships (sometime in 2026).
We welcome contributions! Please see our Contributing Guide for details on how to get started.
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.
This repo is licensed under MIT License.
The 'pg' package is a PostgreSQL client for Node.js. It allows you to interact with PostgreSQL databases using SQL queries. Unlike @supabase/postgrest-js, which provides a higher-level abstraction for CRUD operations and real-time subscriptions, 'pg' requires you to write raw SQL queries and manage connections manually.
Knex.js is a SQL query builder for Node.js, supporting multiple database types including PostgreSQL. It provides a more flexible and powerful way to build SQL queries compared to @supabase/postgrest-js. However, it does not offer built-in real-time subscriptions and requires more setup for basic CRUD operations.
Sequelize is a promise-based Node.js ORM for various SQL databases, including PostgreSQL. It provides a higher-level abstraction for database operations, similar to @supabase/postgrest-js, but with more features like model definitions, associations, and migrations. However, it does not natively support real-time subscriptions.
FAQs
Isomorphic PostgREST client
The npm package @supabase/postgrest-js receives a total of 18,510,626 weekly downloads. As such, @supabase/postgrest-js popularity was classified as popular.
We found that @supabase/postgrest-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.