DEV Community

Discussion on: Introducing the Full Stack Typing Boilerplate: Once You ORM, You Can't Go Back!

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Yes, I can go back.

Enter better-sqlite3 / pragma and transactions.

Still I use ODM for MongoDB (Typegoose), and I wouldn't go back.

I am tempted to try NestJS / Mikro-Orm / Fastify, though; but not yet...

Collapse
 
fullstackchris profile image
Chris Frewin

better-sqlite3 may be fine for smaller projects, but with anything large scale where performance is still key, postgresql is still my go-to.

As for Typegoose, that looks interesting in terms of using it for MongoDB (essentially sequalize's ODM cousin I guess?), but the mantra I always remember is that for most cases an ORM system is enough and will provide the best performance. Most of my projects are complex enough where I need my joins and to silo the data exactly where I want it.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I don't really understand, but is it mostly about type checking and IDE integration?

If you are committed to PostGRES, why not writing raw SQL? Won't there be performance loss, and possibly "anti-pattern" not writing it raw? Not to mention you don't do everything while server is running. You also need migration and administration as well as adding extensions, which doesn't have to be in TypeScript. You might consider pgAdmin, terminal, or some kind of workbench. (I mean, why don't you use pg or node-postgres, anyway. ORM and sql builders are for multiple database types' normalization.)

ORM doesn't necessarily more performant than raw SQL, and can be the opposite. As well as, won't you prefer something deep-layered in the SQL, rather than light-layered in the ORM?

MongoDB / Mongoose / Typegoose are a little different. If you don't use ODM, there is practically no schema. (There still remain indexes, though.)

I mentioned SQLite, because I also do desktop app (and I still haven't tried Android app much). I find it hard to install database fully offline for client-side. (I have seen real world app using MySQL, but I don't really know how they did it.)

I find one thing rarely mention in some ORM's as well -- juggling multiple database connections, which can definitely happen for smaller databases, or when you go sometimes offline, sometimes online.