npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@otter-sh/source-postgres

v0.1.0

Published

Postgres source for [Otter](https://github.com/tomnagengast/otter). Implements the `Source` interface from [`@otter-sh/core`](https://www.npmjs.com/package/@otter-sh/core) using `Bun.sql` — **no `pg` or `postgres.js` dependency**. Extracts rows in paginat

Downloads

67

Readme

@otter-sh/source-postgres

Postgres source for Otter. Implements the Source interface from @otter-sh/core using Bun.sqlno pg or postgres.js dependency. Extracts rows in paginated batches of 5 000.

Reads column types from information_schema.columns up front so the target CREATE TABLE uses real Postgres types instead of text.

Install

bun add @otter-sh/source-postgres

Add it to your project's dependencies alongside @otter-sh/core and @otter-sh/cli. Requires Bun.

Configuration

Import postgresSource and declare the source under sources in otter.config.ts:

import { postgresAdapter } from "@otter-sh/adapter-postgres";
import { defineConfig } from "@otter-sh/core";
import { postgresSource } from "@otter-sh/source-postgres";

export default defineConfig({
  profiles: { dev: { target: postgresAdapter({ url: process.env.PG_URL ?? "" }) } },
  sources: {
    stripe_pg: postgresSource({ url: process.env.STRIPE_PG_URL ?? "" }),
  },
  modelsDir: "models",
});

| Option | Type | Default | Description | | ------ | -------- | ------- | --------------------------------- | | url | string | — | Source Postgres connection string |

Streams

A stream name passed to otter load <source>.<stream> is parsed as:

  • "schema.table" → reads from schema.table.
  • "table" (no dot) → reads from public.table.
otter load stripe_pg.charges           # public.charges
otter load stripe_pg.billing.invoices  # billing.invoices

Extract behavior

  • Column types pulled from information_schema.columns.
  • Batched extraction via Bun.sql in pages of 5 000 rows.
  • Without a cursor: select * from <schema>.<table> order by 1 limit 5000 offset <n>.
  • With a cursor: select * from <schema>.<table> where <cursor_field> > <cursor> order by <cursor_field> asc limit 5000.

Incremental loads

Declare an incremental cursor per stream in sources/<name>.ts:

// sources/stripe_pg.ts
import { defineSource } from "@otter-sh/core";

export default defineSource({
  streams: {
    users: {
      write_disposition: "merge",
      primary_key: "id",
      incremental: { cursor_field: "updated_at" },
    },
  },
});

The driver reads the high-water mark from .otter/state.db (key <stream>:<cursor_field>), filters with where <cursor_field> > <cursor>, and writes the last value back after each batch. Pass --full-refresh to otter load to clear the cursor before extract.

Example

otter load stripe_pg.charges --strategy merge --unique-key id
otter load stripe_pg.users   --full-refresh

Full documentation

License

MIT