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

@runlot/pg

v0.1.0-rc.145

Published

node-postgres-compatible adapter for env.db, with adapters for six ORMs

Readme

@runlot/pg

env.db 위에서 node-postgres(pg) 모양으로 쓰는 어댑터입니다. 이미 pg 를 쓰는 코드와 ORM 을 고치지 않고 runlot 의 데이터베이스에 붙일 수 있습니다.

import { Pool } from "@runlot/pg";

export default {
  async fetch(req, env) {
    const pool = new Pool({ db: env.db });
    const { rows } = await pool.query("select id, name from users where id = $1", [1]);
    return Response.json(rows);
  },
};

무엇을 할 수 있나요

  • Pool.query(text, values) — 호출마다 새 세션입니다. 문장 하나짜리 질의에 알맞습니다.
  • Pool.connect() / new Client({ db }) — 세션 하나를 쥐어요. BEGIN … COMMIT, prepared statement, SET 이 그 안에서 유지됩니다. release() 나 end() 로 돌려주세요.
  • 오류는 DatabaseError 로 던지고 err.code 가 SQLSTATE 입니다 (23505 같은 값).
  • types.setTypeParser(oid, fn) 으로 타입 변환을 바꿀 수 있어요. 기본은 pg 와 같습니다 — timestamptz·date 는 Date, int8·numeric 은 문자열입니다.

ORM

| ORM | 쓰는 법 | |---|---| | Prisma | import { PrismaRunlot } from "@runlot/pg/prisma" → new PrismaClient({ adapter: new PrismaRunlot(env.db) }) | | Drizzle | import { drizzle } from "@runlot/pg/drizzle" → drizzle(env.db, { schema }) | | Kysely | import { kysely } from "@runlot/pg/kysely" → kysely<DB>(env.db) | | TypeORM | import { dataSource } from "@runlot/pg/typeorm" → dataSource(env.db, { entities }) | | Sequelize | import { sequelize } from "@runlot/pg/sequelize" → sequelize(env.db) | | Knex | import { knex } from "@runlot/pg/knex" → knex(env.db) |

runlot deploy 로 배포하면 따로 할 일이 없습니다. 배포 번들러(@runlot/pg/bundler)가 pg 를 이 패키지로 풀고, ORM 이 node 내장 모듈을 쓰면 nodejs_compat 를, Prisma 의 WASM 쿼리 컴파일러는 별도 모듈로 runlot.json 에 적습니다.

다른 도구로 직접 묶는다면 같은 일을 해야 합니다: pg → @runlot/pg alias, node 내장은 node: 접두로 외부에 두고 매니페스트에 "compatibilityFlags": ["nodejs_compat"], fs·os·tty 는 빈 스텁, .wasm 은 번들 밖 모듈로 두고 매니페스트 modules 에 { "name", "type": "wasm", "path" } 로 적습니다. buildWorker 를 직접 불러도 됩니다:

import { buildWorker } from "@runlot/pg/bundler";
const { code, report } = await buildWorker({ entry: "src/index.ts", absWorkingDir: process.cwd() });
// report.nodeImports 가 비어 있지 않으면 nodejs_compat, report.wasmModules 는 곁에 실을 파일

개발

pnpm --filter @runlot/pg test        # 가짜 env.db 상대 단위 시험
pnpm --filter @runlot/pg e2e:build   # e2e/*.ts → e2e-dist/*.js (실물 workerd 시험용)
go test ./node/internal/workerd -run TestLiveORM -v   # 실물 workerd 위 ORM 별 E2E