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-effect-kysely

v5.9.0

Published

Prisma generator that creates Effect Schema types from Prisma schema compatible with Kysely

Readme

prisma-effect-kysely

Prisma generator producing Effect Schema types with Kysely-compatible column metadata, branded IDs, and intelligent UUID detection.

Install

bun add prisma-effect-kysely

Setup

generator effect_schemas {
  provider = "prisma-effect-kysely"
  output   = "./generated/effect"
}
npx prisma generate

Output

Three files: enums.ts, types.ts, index.ts.

import { Schema } from "effect";
import { columnType, DateFromInput, generated, Selectable } from "prisma-effect-kysely";

// Branded ID
export const UserId = Schema.UUID.pipe(Schema.brand("UserId"));
export type UserId = typeof UserId.Type;

// Model schema
export const User = Schema.Struct({
  id: columnType(Schema.UUID, Schema.Never, Schema.Never),
  email: Schema.String,
  createdAt: generated(DateFromInput),
});
export type User = typeof User;

// Kysely DB interface
export interface DB {
  User: Selectable<User>;
}

Consumer Usage

import { Selectable, Insertable, Updateable } from "prisma-effect-kysely";
import { User, UserId, DB } from "./generated";

function getUser(id: UserId): Promise<User> { ... }

type UserSelect = Selectable<typeof User>;
type UserInsert = Insertable<typeof User>;
type UserUpdate = Updateable<typeof User>;

const db = new Kysely<DB>({ ... });

Schema names are PascalCase regardless of Prisma model name (session_preferenceSessionPreference).

Field Behavior

  • @default / @updatedAtgenerated() (omitted from insert, optional in update)
  • @id with @defaultcolumnType(type, Never, Never) (read-only)
  • Optional fields → Schema.NullOr(type)
  • Foreign keys → branded ID type from target model

Type Mappings

| Prisma | Effect Schema | | ----------- | --------------------- | | String | Schema.String | | Int / Float | Schema.Number | | BigInt | Schema.BigInt | | Decimal | Schema.String | | Boolean | Schema.Boolean | | DateTime | DateFromInput | | Json | JsonValue | | Bytes | Schema.Uint8Array | | Enum | Schema.Literal(...) | | UUID | Schema.UUID |

Arrays → Schema.Array(t). Nullable → Schema.NullOr(t). DateFromInput accepts Date | string on the encoded side; JsonValue is Schema<JsonValue, JsonValue>. Both are wire-safe (JSON.parse output decodes cleanly).

UUID Detection

Priority order:

  1. Native type: @db.Uuid
  2. Documentation: @db.Uuid in field comment
  3. Field name pattern: id, *_id, *_uuid, uuid

Custom Type Overrides

Use @customType in field docs to override Effect Schema:

model User {
  /// @customType(Schema.String.pipe(Schema.email()))
  email String @unique
  /// @customType(Schema.Number.pipe(Schema.positive()))
  age Int
}

Supported on all Prisma scalar types.

Implicit M2M Join Tables

Prisma columns A/B map to semantic snake_case fields via Schema.fromKey:

export const ProductToProductTag = Schema.Struct({
  product_id: Schema.propertySignature(
    columnType(Schema.UUID, Schema.Never, Schema.Never)
  ).pipe(Schema.fromKey("A")),
  product_tag_id: Schema.propertySignature(
    columnType(Schema.UUID, Schema.Never, Schema.Never)
  ).pipe(Schema.fromKey("B")),
});

Package Exports

| Entry | Contents | | -------------------------------- | ----------------------------------------------------- | | prisma-effect-kysely | Type utilities + runtime helpers (default import) | | prisma-effect-kysely/generator | Prisma generator binary entry | | prisma-effect-kysely/kysely | getSchemas, columnType, generated, type utils | | prisma-effect-kysely/error | NotFoundError, QueryError, QueryParseError, ... | | prisma-effect-kysely/runtime | All runtime utilities |

Development

bun install
bun run test
bun run typecheck
bun run build
bun run prepublishOnly  # lint + typecheck + test + build

Releasing

Uses Changesets.

bun changeset           # add changeset
git add .changeset/ && git commit -m "docs: changeset"
git push

CI opens a "Version Packages" PR. Merging it publishes to npm, tags, and creates a GitHub release. Requires NPM_TOKEN repo secret.

License

MIT