Prisma is an open-source ORM for Node.js and TypeScript backends. It's built for developers who want type-safe database access, a declarative migration workflow, and a visual data browser, without hand-writing SQL for every query. It works behind REST, GraphQL, or gRPC APIs, and fits anything from a monolith to serverless functions and microservices. The toolkit is made up of three parts: Prisma Client for queries, Prisma Migrate for schema changes, and Prisma Studio for browsing data.
prisma.config.ts: a typed configuration file for CLI subcommands like migrate and studio, with an env() helper for reading environment variables safely.prisma dev starts a local PostgreSQL server without needing Docker.Good fit: Node.js or TypeScript backends that want compile-time safety on every database query; teams that prefer a declarative schema file over hand-written migration scripts; projects that need a quick way to inspect and edit data during development through Prisma Studio; both new projects starting from scratch, using the Prisma Postgres or SQLite quickstart, and existing projects with a database that can be introspected into a schema; teams building REST or GraphQL APIs that want the query layer to return plain JavaScript objects with predictable types.
Less of a fit: stacks outside Node.js and TypeScript, since Prisma Client is scoped to that ecosystem; projects that want hand-tuned SQL as the primary interface rather than a generated query builder (raw queries are supported, but that isn't the main workflow); teams that want zero build step, since Prisma Client requires running prisma generate after every schema change and after a fresh install.
Prisma offers two starting points depending on whether you already have a database. For a new project, quickstart guides cover Prisma Postgres or SQLite. If you already have a database, separate guides cover adding Prisma to an existing project or starting a new relational-database project from scratch.
Install the CLI and client:
npm install prisma --save-dev
npm install @prisma/client
Add a generator and datasource block to your Prisma schema:
generator client {
provider = "prisma-client"
output = "../generated"
}
datasource db {
provider = "postgresql"
}
Configure the database connection in prisma.config.ts:
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
})
Generate the client:
npx prisma generate
Re-run npx prisma generate any time the schema changes. For a from-scratch project without an existing database, npx prisma dev starts a local PostgreSQL server with no Docker required, or npx create-db --interactive provisions an instant cloud Prisma Postgres database. Once the client is generated, instantiate it with a driver adapter, such as PrismaPg, and start querying with methods like findMany, create, and update. Environment variables from .env files aren't loaded automatically by prisma.config.ts; import a package like dotenv at the top of the config file if you need that.