Create new project with prisma

Share this video with your friends

Send Tweet
Published 2 years ago
Updated a year ago

In this lesson you write initial boilerplate for prisma (spoiler: it's not bigger than this summary) with typescript infrastructure.

Dimitri Ivashchuk: [0:00] To start our Prisma project we need to install a couple of development dependencies. Let's do yarn @ and expand this snippet. Prisma CLI allows us to generate and instantiate the Prisma projects, TypeScript and ts-node allow us to write and execute typescript files, and @types/node contains the type definitions for Node.js.

[0:25] Let's install the dependencies. In the meantime, we can create the file tsconfig.json where we will specify our configuration for TypeScript. That's it. Let's save it.

[0:45] You can read more about the compiler options object at TypeScript docs under the compiler options, but just note that we can use the most more than features with ESNext and we set the strict mode that means that we enable the strict options for typechecks.

[1:07] We are finally ready to write some Prisma code. Let's do npx prisma init. It has been executed successfully. Let's see what we have got here. We have schema.prisma file with our database connection and the [inaudible] we need for generating the client and .ini file which we use to provide the database connection string to connect to our postgres database.