Hello all! I'm strongly considering adopting the P...
# orm-help
y
Hello all! I'm strongly considering adopting the Prisma ORM for a very large Node/Express project using SQL Server. While some of the other ORM's e.g. Sequelize, TypeORM, are much more mature, most of the excitement obviously, currently surrounds Prisma. I'm hoping that some of you gurus could advise me if Prisma is well suited for this project or perhaps I should be looking elsewhere. My project will likely need the following list of features. Please advise if they are supported and any known issues/limitations I may expect to run into. Please note that my background is in Laravel/Eloquent, so the terminology is written accordingly: • Eager loading • Composite keys • Polymorphism • Singe table inheritance • Subqueries (w/o resorting to raw expressions) • Common table expressions (CTE) • Pagination • Views • Triggers • Stored procedures • CASE statements • SQL functions (
MAX
UPPER
TRIM
, etc.) Obviously, everything could be accomplished by using raw statements, but I'm looking to stay away from that as much as possible. Any other comments/suggestions are welcome and appreciated! 😄 Thanks in advance!
r
@Yaakov 👋 As you’re coming from a class based ORM like Eloquent, you might find Prisma quite different in that aspect because it doesn’t work on classes but simple functions. Things like Inheritance and Polymorphism are not directly supported. But you can use things like Pagination, Composite keys, Eager loading etc. The other stuff like Views, Triggers, Stored Procedures would need to be called using raw queries only, but we will be adding support for those in the future as we’re actively developing this 🙂
y
Thanks @Ryan! You mentioned that Inheritance and Polymorphism are "not directly supported." Why is that? Are these features planned for the future or am I meant to be adopting a different design pattern when using Prisma?
r
You would need to adopt a different design pattern because it’s not your traditional class based ORM. We have a couple of requests related to these: https://github.com/prisma/prisma/issues/2505 https://github.com/prisma/prisma/issues/2371
@Yaakov 👋 Let me know if you have any other queries 🙂
y
As mentioned, this will be used for a Node/Express API. I'm currently deciding on the stack while finishing up another project. Since this is my first project using Node.js and there are SOOO many choices, I'm having some difficulty deciding on the stack 🤔. Are you able to make for me some recommendations for the following? Decided: • API: Node.js • Framework: Express • Database: SQL Server • ORM: Prisma • Frontend: React.js Undecided: • Authentication: ? • Documentation: Thinking of using Swagger. Haven't used it before. Any opinions? • API testing: ? • Unit testing: ? • React CSS library: Do you have an opinion regarding Tailwind? Haven't used it. • React component library: ? Any help will be appreciated. Thank you so much!! 😄
r
I would suggest the following: Frontend: Next.js (React.js under the hood but much better) Authentication: https://next-auth.js.org/ Documentation: Swagger it totally fine API Testing: Jest and Supertest Unit Testing: Jest React CSS Library: Tailwind is good and you get a lot of utility classes out of the box. React Component Library; Ant, Material UI etc. there are lots to choose from depending on your UI and use case 🙂
y
Thanks I really appreciate your help!
👍 1
@Ryan In the end it seems like we'll be using vanilla React instead of Next.js. Can you recommend an alternative auth instead of NextAuth.js?
r
You can go for Auth0
y
Thank you @Ryan! I will look into this. What if I'm looking to self-manage the user's auth, are there any options for that? Maybe module available via NPM that provides the basic framework?
r
I’ll check and get back to you 🙂
y
@Ryan Thanks!