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

supatypes

v1.0.4

Published

Generate TypeScript types from a remote Supabase PostgreSQL database via SSH

Readme

supatypes

Generate TypeScript types from a remote Supabase PostgreSQL database via SSH.

Connects to your server, dumps the database schema, parses tables/views/functions, and generates a fully typed database.types.ts file — all in one command.

Features

  • Generates types for tables, views, and RPC functions
  • Handles PostgreSQL array types (TEXT[]string[])
  • Multi-word types (character varying, double precision, timestamp with time zone)
  • Supports SSH key and password authentication
  • Uploads the generator to the server, runs it there, downloads the result, and cleans up
  • Config file so you only set up once per project

Install

# Global
npm install -g supatypes

# Per project
npm install --save-dev supatypes

Quick start

# 1. Create config file
npx supatypes init

# 2. Generate types
npx supatypes generate

Configuration

Running init creates a .supatypes.json file:

{
  "server": "[email protected]",
  "sshPort": 2222,
  "sshKey": "~/.ssh/id_rsa",
  "dbContainer": "supabase-db-abc123",
  "output": "./database.types.ts"
}

Options

| Field | Required | Description | |-------|----------|-------------| | server | Yes | SSH connection string (e.g. [email protected]) | | sshPort | No | SSH port (default: 22) | | sshKey | One of these | Path to SSH private key | | sshPassword | One of these | SSH password (uses sshpass) | | dbContainer | Yes | Docker container name for the Supabase PostgreSQL instance | | output | No | Output file path (default: ./database.types.ts) |

The config file is automatically added to .gitignore since it may contain server credentials.

CLI

# Generate with default config
npx supatypes generate

# Custom config file
npx supatypes generate -c ./config/typegen.json

# Override output path
npx supatypes generate -o ./src/types/database.ts

# Preview what would happen
npx supatypes generate --dry-run

How it works

  1. Reads your .supatypes.json config
  2. Uploads a self-contained generator script to the server via SCP
  3. SSHs in and runs it — the script calls pg_dump on the Docker container
  4. Parses the SQL schema into TypeScript types (tables, views, functions)
  5. Downloads the generated file to your chosen output path
  6. Cleans up all remote files

The generator runs on the server because it needs direct access to the Docker container running PostgreSQL. No ports need to be exposed beyond SSH.

Type mapping

| PostgreSQL | TypeScript | |-----------|-----------| | text, varchar, char, uuid | string | | integer, bigint, serial, real, numeric | number | | boolean | boolean | | jsonb, json | Json | | timestamptz, date, time | string | | text[], integer[], etc. | string[], number[], etc. |

Requirements

  • Node.js >= 18
  • SSH access to the server running Supabase
  • sshpass installed locally (only if using password auth)
  • Docker must be accessible on the server (the SSH user needs docker permissions)

Licence

MIT