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

@sethucms/adapter-postgres

v0.1.0

Published

PostgreSQL adapter for SethuCMS

Readme

@sethucms/adapter-postgres

PostgreSQL adapter for SethuCMS.

import { PostgresAdapter } from '@sethucms/adapter-postgres';

const adapter = new PostgresAdapter();
await adapter.connect({
  connectionId: 'c1',
  config: { host: 'db.example.com', database: 'app', schema: 'public' }, // ssl defaults to on
  credentials: { user: 'cms_reader', password: '...' },
  readOnly: true,
});

Wrap it in a GuardedAdapter (from @sethucms/adapter-sdk) before using it.

Settings

| Setting | Default | Notes | |---|---|---| | host, database | required | | | port | 5432 | | | schema | public | Only this schema is introspected | | ssl | true | Certificates are verified. Turn off only for local development | | maxConnections | 5 | 1 to 20 | | statementTimeoutMs | 15000 | Enforced by the database |

When readOnly is true the session also sets default_transaction_read_only=on, so the database itself refuses writes even if everything above it failed. Give the database user the fewest privileges it needs.

How it keeps SQL safe

  • Values are never part of the SQL text. They are sent as parameters ($1, $2, ...).
  • Table and column names come only from introspection, must be plain identifiers, and are quoted.
  • Text search escapes %, _ and \ so users cannot inject wildcards.
  • Database error messages are never forwarded; only the code is mapped to a platform error.

Introspection

Reads information_schema. Tables are left out when they have no primary key, a composite primary key, or a name that is not a plain identifier (letters, digits, underscore). The same applies to columns. Columns with types that do not map cleanly (for example tsvector) become strings marked lossy. Foreign keys become many_to_one relations.

Known limits (v0)

  • Pagination uses an offset inside the signed cursor. It is correct and stable (the primary key is always the final sort), but deep pages are slower than keyset pagination. Keyset is the planned upgrade.
  • No batch writes, transactions API, or realtime yet.
  • Full-text search is not declared as supported.

Tests

pnpm --filter @sethucms/adapter-postgres test

Unit tests need no database. To also run the shared conformance suite against a real server:

SETHUCMS_TEST_PG_URL=postgres://user:pass@localhost:5432/postgres pnpm --filter @sethucms/adapter-postgres test

Each run creates a temporary schema and drops it afterwards. Use a throwaway database.