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

@stratal/zenstack-plugin

v0.0.10

Published

ZenStack CLI plugin for Stratal framework — generates connection types, slicing configs, and per-connection migration schemas

Downloads

448

Readme

@stratal/zenstack-plugin

ZenStack plugin for multi-connection database support in Stratal framework applications.

npm version CI License: MIT OpenSSF Scorecard Known Vulnerabilities npm downloads TypeScript Bundle size PRs Welcome GitHub stars

Features

  • Multi-Connection Support — Assign models to named database connections via the @@connection attribute
  • Auto-Generated Slicing Config — Produces a type-safe slicing.ts with connection names and per-connection model lists
  • Per-Connection Migration Schemas — Generates standalone schema.zmodel files for each connection
  • Type Augmentation — Automatically augments the StratalDatabase interface for type-safe database access
  • Cross-Connection Relation Validation — Detects and warns about relations spanning different connections
  • CLI for Migrationsstratal-db CLI wraps ZenStack migrate and push commands per connection

Installation

npm install -D @stratal/zenstack-plugin
# or
yarn add -D @stratal/zenstack-plugin

Peer dependencies

| Package | Required | |---|---| | @zenstackhq/language | Yes | | @zenstackhq/sdk | Yes |

AI Agent Skills

Stratal provides Agent Skills for AI coding assistants like Claude Code and Cursor. Install to give your AI agent knowledge of Stratal patterns, conventions, and APIs:

npx skills add strataljs/stratal

Quick Start

Configure the plugin in your schema.zmodel:

plugin stratal {
  provider = "@stratal/zenstack-plugin"
  output   = "./src/generated"
  default  = "main"
}

model User {
  id    Int    @id @default(autoincrement())
  name  String
  email String @unique

  @@connection("main")
}

model Event {
  id        Int      @id @default(autoincrement())
  name      String
  timestamp DateTime

  @@connection("analytics")
}

Running zenstack generate will produce:

  • src/generated/slicing.ts — connection slicing config with StratalDatabase type augmentation
  • src/generated/connections/main/schema.zmodel — schema containing only main models
  • src/generated/connections/analytics/schema.zmodel — schema containing only analytics models

Plugin Options

| Option | Type | Default | Description | |---|---|---|---| | output | string | ZenStack default output path | Directory for generated files (relative to schema) | | default | string | "main" | Name of the default connection for models without @@connection |

CLI

The stratal-db command manages per-connection migrations and schema pushes.

stratal-db migrate

Run ZenStack migrations for one or all connections.

stratal-db migrate <subcommand> [options]

Subcommands

| Subcommand | Description | |---|---| | dev | Create a new migration (development) | | deploy | Apply pending migrations (production) | | status | Show migration status | | reset | Reset the database and re-apply migrations |

Options

| Option | Alias | Description | |---|---|---| | --connection <name> | -c | Target a single named connection | | --all-connections | | Run for all discovered connections | | --schema <path> | | Path to the root schema (default: schema.zmodel) | | --name <name> | -n | Migration name (only for migrate dev) | | --no-cleanup | | Keep generated per-connection schema files after execution |

stratal-db push

Push schema changes directly to the database for one or all connections.

stratal-db push [options]

Options

| Option | Alias | Description | |---|---|---| | --connection <name> | -c | Target a single named connection | | --all-connections | | Run for all discovered connections | | --schema <path> | | Path to the root schema (default: schema.zmodel) | | --no-cleanup | | Keep generated per-connection schema files after execution |

Both commands require either --connection <name> or --all-connections.

Documentation

Full guides and examples are available at stratal.dev.

License

MIT