Prisma Explained: Databases Without Writing Raw SQL
Introduction Working with a database from code usually means one of two pains: writing raw SQL strings (powerful, but no autocomplete and easy to mistype) or learning a heavy ORM with its own query language. Prisma, released in 2019, offers a third way for TypeScript and Node developers: define your data model once in a readable schema file, and Prisma generates a type-safe client — so database queries get autocomplete, type checking, and errors at write time instead of runtime. Schema first, then a generated client The workflow has three parts. First, a schema file describes your tables: model User { id Int @id @default(autoincrement()) email String @unique name String posts Post[] } model Post { id Int @id @default(autoincrement()) title String authorId Int author User @relation(fields: [authorId], references: [id]) } Second, Prisma Migrate turns schema changes into versioned migration files, so the database evolves safely alongside the cod...