#generator #prisma #api-bindings #rust

bin+lib prisma-rust-schema

A Rust binary to act as a Prisma generator, generating Rust code from Prisma schema files

2 releases

Uses new Rust 2024

new 0.1.1 Apr 19, 2025
0.1.0 Apr 17, 2025

#1318 in Database interfaces

Download history 107/week @ 2025-04-12

107 downloads per month

MIT license

34KB
879 lines

Prisma Rust Schema

A re-export of the Prisma TypeScript types in Rust.


Prisma Rust Schema

Usage

Binary

  1. Install the binary
cargo install prisma-rust-schema
  1. Add the generator config to your .prisma file:
generator prisma_rust_schema {
  provider = "prisma-rust-schema"
  output   = "./src/prisma"
}
  1. Run the generator
npx prisma generate
  1. Use the generated code in your Rust project:
use prisma::MyModel;

Library

This crate exports the internal TypeScript types from prisma/prisma.

Constraints

Currently, all enums and structs generated have #[derive(Serialize, Deserialize, Debug)] and #[serde(rename_all = "camelCase")] attributes. In future versions, this will be configurable.

Development

npx prisma generate

Dependencies

~0.7–1.6MB
~35K SLoC