RedwoodJS uses Prisma, a next generation ORM, to talk to a database.
Prisma Benefits
What’s nice about Prisma is that it helps you not only connect to a database, but it also:
- Defines your schema
- Runs migrations
- Seeds your database
- Digs into the data with its built-in studio
- Offers friendly way to query/update data without having to write complex SQL
- This is great for nested reads or writes where you might have to do complicated joins.
- You can always write raw (but safe) SQL to execute any query or update you may need to.
- You like CTE’s right?
Pick Your Database of Choice
Prisma also gives you choice of databases without having to change how you access it. There are some differences, but for all intents and purposes switching from MySQL to Postgres is painless.
It supports Postgres, MySQL, SQLite, MongoDB, PlanetScale, SQL Server, and CockroachDB. Which database do I choose – that’s another topic, but Postgres is a solid choice.
Learn More
- Official Prisma and their document reference is an invaluable resource for why Prisma.
- Guide to Data Modeling is an intro to data modeling that explains all the terminology you’ll start seeing like CRUD, columns, inner join, ORM, table, and so many more.
- How RedwoodJS scaffolds work with Prisma relations.
- Pooling, PgBouncer and how you can configure Prisma.
- The How To Prisma Getting Started with Prisma course by @chenkie is an excellent intro – plus, it’s powered by CourseLift which is made with RedwoodJS, too!