Prisma is an open source database toolkit. It consists of three main tools:

  • Prisma Client: An auto-generated and type-safe query builder for Node.js and TypeScript.
  • Prisma Migrate: A declarative data modeling and migration system.
  • Prisma Studio: A GUI to view and edit data in your database.

These tools aim to increase an application developer’s productivity in their database workflows. One of the top benefits of Prisma is the level of abstraction it provides: Instead of figuring out complex SQL queries or schema migrations, application developers can reason about their data in a more intuitive way when using Prisma to work with their database.

In this tutorial, you will build a REST API for a small blogging application in  TypeScript using Prisma and a  PostgreSQL database. You will set up your PostgreSQL database locally with  Docker and implement the REST API routes using  Express. At the end of the tutorial, you will have a web server running locally on your machine that can respond to various HTTP requests and read and write data in the database.


This tutorial assumes the following:

  • Node.js v10 or higher installed on your machine. You can use one of the  How To Install Node.js and Create a Local Development Environment guides for your OS to set this up.
  • Docker installed on your machine (to run the PostgreSQL database). You can install on macOS and Windows via the  Docker website, or follow  How To Install and User Docker for Linux distributions.

Basic familiarity with TypeScript and REST APIs is helpful but not required for this tutorial.

#postgresql #prisma #rest api

How to Build a REST API with Prisma and PostgreSQL
13.55 GEEK