FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.89k stars 139 forks source link

[Suggestion] Prisma2 support #856

Closed Sharlaan closed 3 years ago

Sharlaan commented 3 years ago

https://www.prisma.io/docs/concepts/more/comparisons/prisma-and-typeorm

Prisma seems to offer many advantages (especially te better type safety, and leaness) over TypeORM, what do you think to make it default within FoalTS ?

Only drawback seems to be Mongo Support which is still WIP.

Some infos for a potential @foal/prisma :p https://www.prisma.io/docs/guides/migrate-to-prisma/migrate-from-typeorm

agustif commented 3 years ago

Hey I was confused because I read on prisma docs they recommended foal: https://www.prisma.io/docs/concepts/overview/prisma-in-your-stack/rest

That's some prescient stuff I guess.

Can't wait to see this implemented, although I love typeorm, it seems it doesn't have a bright future upfront!

Maybe would be nice to be able to use any ORM with adapters or extra packages, so foal is ORM-agnostic even if coming with some default choice or something, idk!

Anyway, Thanks @LoicPoullain for the awesome work, just discovered the framework and really happy to start testing it

LoicPoullain commented 3 years ago

Anyway, Thanks @LoicPoullain for the awesome work, just discovered the framework and really happy to start testing it

Glad you like it!

Maybe would be nice to be able to use any ORM with adapters or extra packages, so foal is ORM-agnostic even if coming with some default choice or something, idk!

Foal is already ORM-agnostic, so you can use the ORM/ODM that you wish with it. TypeORM is only provided as a default option (https://foalts.org/docs/databases/using-another-orm). The only part of the framework that is specific to this ORM is the foal generate rest-api command and the groups and permissions.

I will need some time to study Prisma (currently working on websockets) and understand how it's different from a classic ORM (if you have some basic examples, I'll be happy to see them). In any case, Foal will continue to support TypeORM (for product stability and because, even if it has drawbacks, it is still a solution that "works"). But Prisma could be another option also provided by the framework.

In your view, what would supporting Prisma mean? Adding a @foal/prisma package with a fetchUser function (for auth)? Could it be done by simply adding Prisma examples in the docs?

Thanks

Sharlaan commented 3 years ago

What i love about Foal is the abstraction it provides over integrating popular packages like Typeorm, saving developer from the hassle of writing all the required loc (while still keeping customisation of underlying parameters)

I'll have a look into that doc section about using another ORM, maybe Prisma integration might be much easier than i thought ;)

LoicPoullain commented 3 years ago

Guidelines on how to integrate Prisma with Foal have been added to v2.3 documentation. The framework needed a small new feature for that.

The documentation will be accessible on the website once v2.3 is released. In the meantime, you can read it here.

Feel free to reach me back if you have trouble with the new docs. 👍