{
  "id": 11067942,
  "title": "Outline: Add Prisma ORM to a Node.js project using PostgreSQL DB",
  "url": "https://urgent.news/2026/10/01/outline-add-prisma-orm-to-a-node-js-project-using-postgresql-db",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-01T00:23:52.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/juddee/outline-add-prisma-orm-to-a-nodejs-project-using-postgresql-db-3j2b"
  },
  "original_language": "en",
  "account": "To add Prisma ORM to a Node.js project with a PostgreSQL database, follow these steps:\n\n1. Begin by installing the necessary packages and dependencies. Navigate to your project directory or create a new one, then run the following commands using your preferred package manager:\n\n```\nnpm install prisma@prev @types/node @types/pg --save-dev\nnpm install @prisma/client@7 @prisma/adapter-pg pg dotenv\n```\n\n2. Prisma is a CLI tool that allows you to run various commands in the terminal, such as `prisma init`, `migrate`, `pull`, and `studio`. The `@prisma/client` package is the client library used for querying the database, while `@prisma/adapter-pg`, `pg`, and `@types/pg` provide the Postgres driver adapter, driver, and TypeScript type definitions to connect Prisma to the client Postgres database.\n\n3. Initialize Prisma by running this command:\n\n```\nnpx prisma init --datasource-provider postgresql --output ../generated/prisma\n```\n\nThis action creates a `prisma` folder containing the `schema.prisma` file, which holds your database connection setup, as well as a `.env` file and a `prisma7.config.ts` file in the root directory.\n\n4. Connect your database by editing the connection details in the `.env` file. It should look like this:\n\n```\nDATABASE_URL = postgresql://user:password@localhost:5432/mydb?schema=public\n```\n\nReplace the `user`, `password`, and `mydb` with your actual database credentials and name.\n\n5. Next, you have two options:\n\na. Pull your existing database by running:\n\n```\nnpx prisma db pull\n```\n\nThis command updates the `schema.prisma` file based on your current database schema.\n\nb. Alternatively, update the `prisma/schema.prisma` file, generator client configuration, and define your models, such as the `User` model below:\n\n```prisma\ngenerator client {\nprovider = \"prisma-client\"\noutput = \"../generated/prisma\"\n}\n\ndatasource db {\nprovider = \"postgresql\"\n}\n\nmodel User {\nid Int @id @default(autoincrement())\nname String\nemail String @unique\n}\n```\n\nAdd any other tables you may need for your application.\n\n6. Finally, run the migration to apply the changes to your database with this command:\n\n```\nnpx prisma migrate dev --name init\n```\n\nThis step will create the necessary database tables based on your Prisma schema, and your Node.js project is now ready to use Prisma ORM with a PostgreSQL database.",
  "summary": "Quick outline to add Prisma ORM to any Node.js or Express project using a PostgreSQL DB. This outline will work if adding Prisma to an existing or new Node.js project. Install required packages and dependencies Navigate to your project directory or create the project directory and install these required dependencies using any package manager you like: npm install prisma@prev @types/node @types/pg…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}