MICROSIVE

Prisma ORM development for TypeScript apps on PostgreSQL

Prisma makes the database feel like part of the TypeScript code. That saves time on routine queries and needs care around migrations.

Reviewed by: Rahul Jaiswar, founder

Does Prisma fit your app?

Prisma suits TypeScript apps where database types should flow into the code, schema changes should be reviewable files, and most queries are standard reads and writes with relations. Reports that need window functions or recursive queries read better as raw SQL beside it. A Python service has its own tools, and two ORMs over one schema need one clear owner for migrations.

How Prisma works

Prisma is an ORM for Node.js and TypeScript. You describe the data model in a schema file, and Prisma generates a typed client for queries plus SQL migration files for each change.

Where we use it

Microsive ATS uses Prisma.

What we check

Each query that reads client data states its filter, including the linked records underneath it. Scoping only the top-level query is the trap, because the code compiles either way.

Pitfalls, including the Prisma 7 upgrade

  • Migration drift. A quick fix applied straight to the production database leaves migration history out of step, so the next migration can fail or migrate dev asks to reset the database. Send schema changes through migrations only.
  • Unsafe raw queries. $queryRawUnsafe with string concatenation invites SQL injection. Use the tagged-template form for raw queries, which parameterises values.
  • A client created at import time. Creating the Prisma client when a module loads can make the database URL a build-time requirement, which breaks container builds and CI runs without secrets. Create the client lazily, on first use.
  • Upgrading to Prisma 7. Version 7 uses a Rust-free client that connects through driver adapters, reads its settings from prisma.config.ts, and no longer loads .env automatically. Load environment variables in the config yourself, and check that prisma generate still runs in CI and container builds, because the config’s env lookup can fail there too.

Apps built on Prisma come under our web apps service.

Planning a TypeScript app on PostgreSQL?

Describe the records it holds and who uses them, or tell us what the Prisma setup you already have is doing wrong.