Skip to content

Instantly share code, notes, and snippets.

@bdsqqq
Created September 5, 2022 22:00
Show Gist options
  • Save bdsqqq/25c2d2b5509b5793fd9ae1fd3bd491e1 to your computer and use it in GitHub Desktop.
Save bdsqqq/25c2d2b5509b5793fd9ae1fd3bd491e1 to your computer and use it in GitHub Desktop.
Prisma
  • [1] Next-generation Node.js and TypeScript ORM.
  • [1] Get started in minutes with a new or existing database.
  • [1] Use full type safety and automated workflows to ship schema changes and write queries with less work.
    • Prisma Client is a query builder that composes queries the way you think and is auto-generated from the Prisma schema with types tailored to your app.
    • Prisma Migrate automatically generates SQL database migrations, that are fully customizable, enabling you to make changes to the database without generating migration files.
  • [2][3] Prisma makes SQL so easy you'll barely notice you're using it.
  • [4] Prisma is a database toolkit that covers the daily workflows of application developers that interact with databases. A few examples are:
    • querying (with Prisma Client)
    • data modeling (in the Prisma schema)
    • migrations (with Prisma Migrate)
    • prototyping (via prisma db push)
    • seeding (via prisma db seed)
    • visual viewing and editing (with Prisma Studio)
  • [5] Prisma is the only fully type-safe ORM in the TypeScript ecosystem. The generated Prisma Client ensure typed query results even for partial queries and relations. You can learn more about this in the type-safety comparison with TypeORM.
  • [6] With Prisma, you are building the backend yourself using Node.js or TypeScript. This means you'll have to do a lot more coding work compared to using a BaaS. The benefit of this approach is that you have full flexibility for building, deploying, scaling and maintaining your backend and are not dependent on 3rd party software for a crucial part of your stack.
  • [7] Prisma's main benefit is to provide an abstraction layer that makes you more productive compared to writing SQL.
  • [8] Prisma proved out a developer experience that didn't exist before. (typesafe Schema with good dx). Prisma has a lot of tech debt (rust bindings?), limited by design because internals, not edge ready--keeps our serves from performing as fast as we know they can. BUT the DX wins make it worth for most cases.
  • [9] Prisma is an interface and a description of the state of your database.
  • [9] Similar to ORMs, prisma blurs the lines between Schema, query builder and query client. Meaning that you lose control and understanding over the parts. (Things like https://github.com/depot/kysely-planetscale are being developed tho). // This should probably go in the "more in depth" page

Sources: [1] https://www.prisma.io/ [2] https://twitter.com/JacobMGEvans/status/1459961677374447618 [3] https://twitter.com/t3dotgg/status/1459969825061543937 [4] https://www.prisma.io/docs/concepts/overview/should-you-use-prisma#-you-want-a-tool-that-holistically-covers-your-database-workflows [5] https://www.prisma.io/docs/concepts/overview/should-you-use-prisma#-you-value-type-safety [6] https://www.prisma.io/docs/concepts/overview/should-you-use-prisma#-you-do-not-want-to-write-any-code-for-your-backend [7] https://www.prisma.io/docs/concepts/overview/should-you-use-prisma#-you-want-to-use-raw-type-safe-sql-for-querying-your-database [8] https://clips.twitch.tv/AdventurousStylishClipsdadTakeNRG-Ao3huU8K5cXLwPiW [9] https://www.twitch.tv/videos/1578144258?t=2h56m00s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment