Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ This article is part of a series of [live streams](https://www.youtube.com/playl

<Youtube videoId="SvtXgRA7KsE" />

:::note[Part one of four]
This is the first article in the **Backend with TypeScript, PostgreSQL & Prisma** series:

1. **Data modeling & CRUD** (you're here)
2. [REST, validation & tests](/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3)
3. [Authentication & authorization](/backend-prisma-typescript-orm-with-postgresql-auth-mngp1ps7kip4)
4. [CI & deployment](/backend-prisma-typescript-orm-with-postgresql-deployment-bbba1ps7kip5)
:::

## Introduction

The goal of the series is to explore and demonstrate different patterns, problems, and architectures for a modern backend by solving a concrete problem: **a grading system for online courses.** This is a good example because it features diverse relations types and is complex enough to represent a real-world use-case.
Expand Down Expand Up @@ -69,6 +78,10 @@ If you're using Visual Studio Code, the [Prisma extension](https://marketplace.v

> **Note**: If you don't want to use Docker, you can set up a [local PostgreSQL database](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database) or a [hosted PostgreSQL database on Heroku](https://dev.to/prisma/how-to-setup-a-free-postgresql-database-on-heroku-1dc1).

:::ppg[Don't want to run Docker?]
The tutorial runs Postgres in a local container, which still works. If you'd rather skip that, create a [Prisma Postgres](https://www.prisma.io/postgres) database and use its connection string as your `DATABASE_URL`. Every schema, migration, and query step below is the same either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use local prisma postgres or npx create-db, provide back links to our docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The callout now points to npx create-db (https://www.prisma.io/docs/postgres/introduction/npx-create-db) and local Prisma Postgres (https://www.prisma.io/docs/postgres/database/local-development), both linked to docs, with the connection string going straight into DATABASE_URL.

:::

## Clone the repository

The source code for the series can be found on [GitHub](https://github.com/2color/real-world-grading-app).
Expand Down Expand Up @@ -861,3 +874,9 @@ In the next parts of the series, you'll learn more about:
- Deployment

**Join for the [the next live stream](https://youtu.be/d9v7umfMNkM) which will be streamed live on YouTube at 6:00 PM CEST August 12th.**

:::tip[A note on versions]
This series uses an older version of Prisma ORM. The data modeling and query patterns still hold, but the tooling has moved on. [Prisma Next](https://www.prisma.io/blog/the-next-evolution-of-prisma-orm) is where the ORM is going: you describe your data in one contract file, and it generates the client and migrations from there. When you reach deployment in part four, [Prisma Postgres](https://www.prisma.io/postgres) and [Prisma Compute](https://www.prisma.io/compute) (public beta) can handle your database and hosting without leaving Prisma.

Next in the series: [REST, validation & tests](/backend-prisma-typescript-orm-with-postgresql-rest-api-validation-dcba1ps7kip3), then [authentication & authorization](/backend-prisma-typescript-orm-with-postgresql-auth-mngp1ps7kip4) and [CI & deployment](/backend-prisma-typescript-orm-with-postgresql-deployment-bbba1ps7kip5).
:::
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ This change will come later this year as part of Prisma ORM v7 and only affect t
- More predictability and no more workarounds due to magical behavior.
- Compliance with the assumption that `node_modules` can only be modified by package managers.

:::note[Part of a bigger change]
Getting the generated client out of `node_modules` is one piece of a bigger change. [Prisma Next](https://www.prisma.io/blog/the-next-evolution-of-prisma-orm) takes the idea all the way: you keep a single data contract, and the generated client lands in your source tree as normal code. You can read it, commit it, and bundle it like anything else, never hidden in `node_modules`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this connects.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked this callout — it no longer jumps to "data contract" (off-topic for this article). It now bridges directly from the v7 output-path change to Prisma Next: the same principle (treat the generated client as ordinary source code in your project, not something hidden in node_modules), carried forward into the next major version.

:::

### `prisma-client` vs `prisma-client-js` generators

If you've followed our releases, you know that in [v6.6.0](https://github.com/prisma/prisma/releases/tag/6.6.0) we released a new generator, called simply [`prisma-client`](https://www.prisma.io/docs/orm/prisma-schema/overview/generators#prisma-client-early-access):
Expand Down Expand Up @@ -108,3 +112,7 @@ Here's a TLDR for what all of this means for you today:
- **If you experience issues with an `output` path** (regardless of whether you use the new `prisma-client` or the current `prisma-client-js` generator), please [open a new issue](https://github.com/prisma/prisma/issues) so we can help you resolve the problem.

As always, [reach out to us on X](https://pris.ly/x) or [join our Discord](https://pris.ly/discord) if you have any feedback or questions!

:::ppg[Starting a new project?]
If you're setting an `output` path on a new project as suggested above, the database and hosting can come from the same place. [Prisma Postgres](https://www.prisma.io/postgres) gives you a managed Postgres database, and [Prisma Compute](https://www.prisma.io/compute) (public beta) runs your TypeScript app next to it. The ORM itself is heading toward [Prisma Next](https://www.prisma.io/blog/the-next-evolution-of-prisma-orm).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how this connects.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconnected to the article's own "starting a new project today" advice. If you're setting an output path on a fresh project, you still need a database for DATABASE_URL to point at — so the callout now leads with npx create-db (Prisma Postgres), then Prisma Compute for hosting, then Prisma Next for where the ORM goes after v7.

:::
Loading