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

goldlapel

v0.1.0-rc3

Published

Self-optimizing Postgres proxy — automatic materialized views and indexes

Downloads

163

Readme

Gold Lapel

Self-optimizing Postgres proxy — automatic materialized views and indexes. Zero code changes required.

Gold Lapel sits between your app and Postgres, watches query patterns, and automatically creates materialized views and indexes to make your database faster. Port 7932 (79 = atomic number for gold, 32 from Postgres).

Install

npm install goldlapel

Quick Start

import goldlapel from 'goldlapel';

// Start the proxy — returns a connection string pointing at Gold Lapel
const url = await goldlapel.start('postgresql://user:pass@localhost:5432/mydb');

// Use the URL with any Postgres driver
import pg from 'pg';
const client = new pg.Client({ connectionString: url });
await client.connect();

// Or Prisma, Drizzle, Knex, TypeORM — anything that speaks Postgres

Gold Lapel is driver-agnostic. start() returns a connection string (postgresql://...@localhost:7932/...) that works with any Postgres driver or ORM.

After startup, Gold Lapel prints a one-line summary and serves a dashboard at http://127.0.0.1:7933 by default:

const dashUrl = goldlapel.dashboardUrl();
// => "http://127.0.0.1:7933" (or null if not running / dashboard disabled)

API

goldlapel.start(upstream, opts)

Starts the Gold Lapel proxy and returns the proxy connection string. Returns a Promise.

  • upstream — your Postgres connection string (e.g. postgresql://user:pass@localhost:5432/mydb)
  • opts.port — proxy port (default: 7932)
  • opts.config — config object (see Configuration)
  • opts.extraArgs — additional CLI flags passed to the binary (e.g. ['--threshold-impact', '5000'])

goldlapel.stop()

Stops the proxy. Also called automatically on process exit.

goldlapel.proxyUrl()

Returns the current proxy URL, or null if not running.

goldlapel.dashboardUrl()

Returns the dashboard URL (e.g. http://127.0.0.1:7933), or null if not running or the dashboard is disabled (dashboardPort: 0).

new goldlapel.GoldLapel(upstream, opts)

Class interface for managing multiple instances:

import { GoldLapel } from 'goldlapel';

const proxy = new GoldLapel('postgresql://user:pass@localhost:5432/mydb', { port: 7932 });
const url = await proxy.start();
// ...
proxy.stop();

Configuration

Pass a config object to configure the proxy:

import goldlapel from 'goldlapel'

const url = await goldlapel.start('postgresql://user:pass@localhost/mydb', {
  config: {
    mode: 'butler',
    poolSize: 50,
    disableMatviews: true,
    replica: ['postgresql://user:pass@replica1/mydb'],
  },
})

Keys use camelCase and map to CLI flags (poolSize--pool-size). Boolean keys are flags — true enables them. Array keys produce repeated flags.

Unknown keys throw immediately. To see all valid keys:

import { configKeys } from 'goldlapel'
console.log(configKeys())

For the full configuration reference, see the main documentation.

Raw CLI flags

You can also pass raw CLI flags via extraArgs:

const url = await goldlapel.start(
    'postgresql://user:pass@localhost:5432/mydb',
    { extraArgs: ['--threshold-duration-ms', '200', '--refresh-interval-secs', '30'] }
);

Or set environment variables (GOLDLAPEL_PORT, GOLDLAPEL_UPSTREAM, etc.) — the binary reads them automatically.

How It Works

This package bundles the Gold Lapel Rust binary for your platform. When you call start(), it:

  1. Locates the binary (bundled in package, on PATH, or via GOLDLAPEL_BINARY env var)
  2. Spawns it as a subprocess listening on localhost
  3. Waits for the port to be ready
  4. Returns a connection string pointing at the proxy
  5. Cleans up automatically on process exit

The binary does all the work — this wrapper just manages its lifecycle.

Links