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

prisma-zero

v0.1.1

Published

Generate Zero schemas from Prisma ORM schemas

Readme

prisma-zero

Generate Zero schemas from Prisma schemas.

Installation

npm install prisma-zero
# or
bun add prisma-zero
# or
yarn add prisma-zero
# or
pnpm add prisma-zero

Usage

Add a new generator to your prisma.schema:

generator zero {
  provider = "prisma-zero"
}

Add the schema generation script to your package.json:

{
  "scripts": {
    "generate": "prisma generate",
    "postinstall": "npm generate"
  }
}

Please reference the Zero docs for how to use your new Zero schema: https://zero.rocicorp.dev/docs/reading-data.

Postgres Array Support

Since Zero doesn't natively support Postgres arrays, this generator automatically maps array fields to JSON storage while preserving TypeScript type safety:

model User {
  id          String   @id @default(cuid())
  email       String   @unique
  tags        String[] // Maps to json<string[]>()
  scores      Int[]    // Maps to json<number[]>()
  categories  Category[] // Maps to json<Category[]>() for enum arrays
}

enum Category {
  TECH
  BUSINESS
  LIFESTYLE
}

The generated Zero schema will include:

export const userTable = table('User')
  .columns({
    id: string(),
    email: string(),
    tags: json<string[]>(),
    scores: json<number[]>(),
    categories: json<Category[]>(),
  })
  .primaryKey('id');

Supported Array Types

  • Scalar arrays: String[], Int[], Float[], Boolean[], DateTime[], BigInt[], Decimal[]
  • Enum arrays: MyEnum[]
  • Optional arrays: String[]?json<string[]>().optional()

Configuration

If you want to customize the behavior of the generator you can use the following options:

generator zero {
  // Specify output dir
  output = "generated/zero"
  // When true, the output will be formatted using prettier
  prettier = true
  // When true, the generator will remap table names to camel case using Zero's `.from()` method.
  // You can read more about it here https://zero.rocicorp.dev/docs/zero-schema#name-mapping
  camelCase = true
  // Optional list of Prisma Model names you want to exclude from the generated schema
  // This does *not* change tables that replicate to zero-cache - only the types on the client
  excludeTables = ["Posts", "Comments", ...]
  // When true, skip generating the query builder (`zql` and `builder` exports)
  skipBuilder = true
  // When true, skip generating the module augmentation for default types in Zero
  skipDeclare = true
  // When true, enable legacy CRUD mutators (sets `enableLegacyMutators` to `true` in the generated schema)
  enableLegacyMutators = true
  // When true, enable legacy CRUD queries (sets `enableLegacyQueries` to `true` in the generated schema)
  enableLegacyQueries = true
}

Attribution

Thank you to @elledienne who built @passionfroot/prisma-generator-zero, which this is heavily based on.