Prisma is a next-generation TypeScript ORM that provides auto-generated, type-safe database access for Node.js and TypeScript applications, supporting PostgreSQL, MySQL, SQLite, SQL Server, CockroachDB, and more (MongoDB support is planned for Prisma 8). Unlike traditional ORMs, Prisma uses a declarative schema file as the single source of truth, automatically generating a fully-typed client that eliminates runtime errors and provides unmatched developer experience. As of Prisma 7, the client is entirely Rust-free — powered by a WASM-based query compiler with built-in query plan caching — and configured via a prisma.config.ts file for explicit, type-safe project setup. The key insight: Prisma's schema-first approach ensures type safety flows from database to application code, while automatic query batching and a query caching layer optimize performance at scale.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 159 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Schema Data Types
| Type | Example | Description |
|---|---|---|
name String | • Variable-length text • maps to VARCHAR in SQL databases and string in TypeScript. | |
age Int | • 32-bit signed integer • maps to INTEGER in SQL and number in TypeScript. | |
isActive Boolean | • True/false value • maps to BOOLEAN in PostgreSQL, TINYINT(1) in MySQL. | |
createdAt DateTime | • Timestamp with timezone (PostgreSQL) or without (MySQL) • use @updatedAt for auto-update. | |
price Float | • Double-precision floating point • use Decimal for financial calculations to avoid rounding errors. | |
amount Decimal | • Arbitrary precision decimal using Decimal.js library • critical for currency and financial data. |