#schema #prisma #binary #generator #constraints

app prisma-rust-schema

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

1 unstable release

Uses new Rust 2024

new 0.1.0 Apr 17, 2025

#452 in Database interfaces

MIT license

45KB
957 lines

Prisma Rust Schema

Usage

  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;

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