multipliedtwice/prisma-generator-express

Ship Prisma APIs faster with generated Express, Fastify, or Hono CRUD routes, OpenAPI, pagination, hooks, and guard integration.

27

stars

414

commits

TypeScript

primary language

Sep 8, 2026

updated

multipliedtwice.github.io/prisma-generator-express/
api
api-rest
crud
express
generator
prisma
Browse cluster: Prisma code generation and GraphQL

README

Prisma Generator Express logo

Prisma Generator Express

Ship Prisma APIs faster by generating Express, Fastify, or Hono CRUD routes, OpenAPI, pagination, hooks, and guard integration directly from your schema.

npm version npm downloads Coverage License

Field Guide · Full reference · npm

Quickstart

npm install -D prisma-generator-express
npm install @prisma/client express
// schema.prisma
generator client {
  provider = "prisma-client-js"
}

generator express {
  provider = "prisma-generator-express"
}
npx prisma generate

Mount the generated router:

import express from 'express'
import { PrismaClient } from '@prisma/client'
import { UserRouter } from './generated/User/UserRouter'

const prisma = new PrismaClient()
const app = express()

app.use(express.json())

app.use((req, res, next) => {
  req.prisma = prisma
  next()
})

app.use('/', UserRouter({ enableAll: true }))

app.listen(3000)

That is a full CRUD API with OpenAPI docs at /user/openapi.json.

enableAll: true exposes every operation of the model. For anything beyond internal tools, restrict operations and add guard shapes — see guard integration.

What you get

  • Handler functions for all Prisma operations (findMany, create, update, delete, aggregates and more) — request body format
  • Express, Fastify, and Hono targets via the target generator option — Express / Fastify / Hono
  • OpenAPI 3.1 spec (JSON + YAML) registered automatically per router — documentation endpoints
  • Router generator with operation-wide and per-variant before/after hooks — selective routes
  • Schema-level findManyPaginated execution mode (Promise.all or interactive transaction) — execution mode
  • Per-route and per-endpoint pagination config, including materialized-view count sources — pagination
  • POST read endpoints for complex queries exceeding URL length limits — POST reads
  • Guard/variant shape enforcement with tenant isolation via prisma-guardguard shapes
  • Express-only progressive read streaming over SSE (manual stages or auto-include splitting) — progressive composition
  • Express-only read-only materialized view router — materialized views
  • Client-side query parameter encoder — query encoding
  • SQL optimization via optional prisma-sql integration

Compatibility

FrameworkTarget valueGenerated output
Express"express" (default)express.Router() factory per model
Fastify"fastify"Fastify plugin function per model
Hono"hono"Hono instance factory per model

Minimum supported Prisma version: 6.0.0 (CI generates and strict-typechecks emitted output against the latest 6.x and 7.x lines). Some operations require newer versions or specific database providers — see the compatibility section for the exact matrix.

Progressive SSE streaming and the materialized views router are Express-only today.

Documentation

The full reference lives in docs/guide.md:

Maintainer-facing design notes: ARCHITECTURE.md.

License

MIT

Contributors

multipliedtwice

154 commits

danil-iglu

115 commits

dependabot[bot]

13 commits

multipliedtwice/prisma-generator-express

Ship Prisma APIs faster with generated Express, Fastify, or Hono CRUD routes, OpenAPI, pagination, hooks, and guard integration.

27

stars

414

commits

TypeScript

primary language

Sep 8, 2026

updated

multipliedtwice.github.io/prisma-generator-express/
api
api-rest
crud
express
generator
prisma
Browse cluster: Prisma code generation and GraphQL

README

Prisma Generator Express logo

Prisma Generator Express

Ship Prisma APIs faster by generating Express, Fastify, or Hono CRUD routes, OpenAPI, pagination, hooks, and guard integration directly from your schema.

npm version npm downloads Coverage License

Field Guide · Full reference · npm

Quickstart

npm install -D prisma-generator-express
npm install @prisma/client express
// schema.prisma
generator client {
  provider = "prisma-client-js"
}

generator express {
  provider = "prisma-generator-express"
}
npx prisma generate

Mount the generated router:

import express from 'express'
import { PrismaClient } from '@prisma/client'
import { UserRouter } from './generated/User/UserRouter'

const prisma = new PrismaClient()
const app = express()

app.use(express.json())

app.use((req, res, next) => {
  req.prisma = prisma
  next()
})

app.use('/', UserRouter({ enableAll: true }))

app.listen(3000)

That is a full CRUD API with OpenAPI docs at /user/openapi.json.

enableAll: true exposes every operation of the model. For anything beyond internal tools, restrict operations and add guard shapes — see guard integration.

What you get

  • Handler functions for all Prisma operations (findMany, create, update, delete, aggregates and more) — request body format
  • Express, Fastify, and Hono targets via the target generator option — Express / Fastify / Hono
  • OpenAPI 3.1 spec (JSON + YAML) registered automatically per router — documentation endpoints
  • Router generator with operation-wide and per-variant before/after hooks — selective routes
  • Schema-level findManyPaginated execution mode (Promise.all or interactive transaction) — execution mode
  • Per-route and per-endpoint pagination config, including materialized-view count sources — pagination
  • POST read endpoints for complex queries exceeding URL length limits — POST reads
  • Guard/variant shape enforcement with tenant isolation via prisma-guardguard shapes
  • Express-only progressive read streaming over SSE (manual stages or auto-include splitting) — progressive composition
  • Express-only read-only materialized view router — materialized views
  • Client-side query parameter encoder — query encoding
  • SQL optimization via optional prisma-sql integration

Compatibility

FrameworkTarget valueGenerated output
Express"express" (default)express.Router() factory per model
Fastify"fastify"Fastify plugin function per model
Hono"hono"Hono instance factory per model

Minimum supported Prisma version: 6.0.0 (CI generates and strict-typechecks emitted output against the latest 6.x and 7.x lines). Some operations require newer versions or specific database providers — see the compatibility section for the exact matrix.

Progressive SSE streaming and the materialized views router are Express-only today.

Documentation

The full reference lives in docs/guide.md:

Maintainer-facing design notes: ARCHITECTURE.md.

License

MIT

Contributors

multipliedtwice

154 commits

danil-iglu

115 commits

dependabot[bot]

13 commits

Languages

TypeScript

93.3%

JavaScript

6.6%