Native Perry implementation of Prisma ORM. Drop-in replacement for @prisma/client backed by sqlx + MySQL via Rust FFI.
Compiles your Prisma schema and TypeScript into a single native binary -- no Node.js, no Prisma engine, no runtime dependencies.
- Full Prisma client API:
findMany,findFirst,findUnique,create,createMany,update,updateMany,upsert,delete,deleteMany,count - WHERE filters:
equals,not,gt,gte,lt,lte,in,notIn,contains,startsWith,endsWith,AND,OR,NOT - Pagination & ordering:
take,skip,orderBy,select - Transactions:
$transactionwith commit/rollback - Raw SQL:
$executeRaw,$queryRaw - Reads
schema.prismaat build time -- zero runtime schema parsing
import { createPrismaClient } from "perry-prisma";
var prisma = createPrismaClient({
datasourceUrl: "mysql://user:pass@localhost:3306/mydb"
});
prisma.$connect();
// CRUD
var user = prisma.user.create({
data: { id: "1", email: "alice@example.com", ... }
});
var users = prisma.user.findMany({
where: { email: { contains: "alice" } },
orderBy: { createdAt: "desc" },
take: 10
});
// Transactions
prisma.$transaction(function (tx) {
prisma.user.create({ data: { ... } });
prisma.post.create({ data: { ... } });
// auto-commits on success, rolls back on throw
});
// Raw SQL
var rows = prisma.$queryRaw("SELECT * FROM User WHERE id = '1'");
prisma.$executeRaw("UPDATE User SET name = 'Bob' WHERE id = '1'");
prisma.$disconnect();- Add your
schema.prismaand setPRISMA_SCHEMA_PATH(or place it at the default path) - Install as a Perry native package:
npm install perry-prisma - Compile with Perry:
perry compile src/main.ts
src/index.ts TypeScript API (PrismaClient, ModelClient, types)
native/src/lib.rs Rust FFI: SQL generation, query execution, transactions
native/build.rs Schema parser: reads schema.prisma at compile time
All FFI calls are synchronous. The Rust layer uses sqlx with a MySQL connection pool, spawning threads with block_on to bridge sync FFI with async sqlx.
Run the full integration test suite against a MySQL database:
DATABASE_URL=mysql://user:pass@host:3306/db ./test/run_all.sh7 test suites, 110 assertions covering CRUD, filters, bulk ops, pagination, transactions, raw SQL, and error handling.
MIT