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

@towerjs/vault

v0.1.1

Published

Database ORM, migrations, and seeds for Tower — built on Kysely with PostgreSQL support

Downloads

47

Readme

@towerjs/vault

npm version

Database layer for Tower. Vault's current public query API is built on Kysely, with PostgreSQL providers for Neon (HTTP) and standard pg connections. It provides migrations, seeds, and connection management. A future application-oriented model API may sit above this query API; it will not replace Kysely or remove the low-level escape hatch.

Installation

pnpm add @towerjs/vault

Usage

Configure Vault in your tower.config.ts:

import { defineTower } from '@towerjs/blueprint'
import { env } from '@towerjs/blueprint'

export default defineTower({
  modules: {
    vault: {
      provider: 'pg',
      connectionString: env.string('DATABASE_URL'),
    },
  },
})

Run queries:

import { vault } from '@towerjs/tower/vault'

await vault.insertInto('users').values({ name: 'Alice', email: '[email protected]' }).execute()

Migrations

Place migration files in src/vault/migrations/:

// src/vault/migrations/001_create_users.ts
import { Kysely, sql } from 'kysely'

export async function up(db: Kysely<unknown>) {
  await db.schema
    .createTable('users')
    .addColumn('id', 'uuid', (c) => c.primaryKey().defaultTo(sql`gen_random_uuid()`))
    .addColumn('email', 'varchar(255)', (c) => c.notNull().unique())
    .execute()
}

export async function down(db: Kysely<unknown>) {
  await db.schema.dropTable('users').execute()
}

Run migrations via the CLI:

tower migrate

Or programmatically:

import { vault } from '@towerjs/tower/vault'
import { migrateToLatest } from '@towerjs/vault'

await migrateToLatest(vault, { folder: 'src/vault/migrations' })

Seeds

Place seed files in src/vault/seeds/ and run:

tower seed

Providers

| Provider | Connection | | -------- | ----------------------------------------------------------- | | Neon | HTTP dialect via kysely-neon (@neondatabase/serverless) | | pg | Standard PostgreSQL via pg (Supabase, Railway, RDS, etc.) |

Configuration

| Option | Default | Description | | ------------------------------ | ------------------ | -------------------------- | | provider | auto-detect | "pg" or "neon" | | connectionString | DATABASE_URL env | Full connection string | | pool.max | 10 | Maximum pool connections | | pool.idleTimeoutMillis | — | Idle connection timeout | | pool.connectionTimeoutMillis | — | Connection attempt timeout | | pool.ssl | auto | SSL configuration |

CLI

tower migrate    — Run pending migrations
tower seed       — Execute seed files
tower about      — Diagnose application, modules, runtime, and environment configuration

Edge Runtime

On Edge Runtime, the pg provider is unavailable (no TCP connections) — use the neon provider instead. Migrations and seeds are not available on Edge; run them locally or in a Node.js environment.

Included in