Only using Redwood for the data modeling layer

Prisma is a pretty great data mapper, but it leaves some big opportunities on the table: creating models with custom behavior, data migrations, etc. I was excited to discover that RedwoodJS fills in many of those gaps!

We already use express, and we can’t go all ham with Redwood and adopt the entire framework. I’m wondering if it would still be viable to use Redwood just for the data modeling layer, e.g being able to do stuff like this:

await User.find(...)

without using all the other many cool features of Redwood?

Hi @AndrewSouthpaw while it would great for you to RedwoodJS, but if you simply want a database layer and need to use express, I think just Prisma has you covered:

You won’t have the RedwoodJS DX or its api-server, but might fit your needs.

All best!

Thanks for the quick reply! Prisma is nice, but it doesn’t cover certain things or offer an interface that I’m in love with. e.g. you have to say prisma.user.findMany({ where: { foo: 'bar' } }) instead of Redwood’s User.where({ foo: 'bar' }) or whatever. Also, Prisma explicitly doesn’t support model-level extensibility with custom behavior at this time, though it is on their roadmap, while it seems Redwood supports this functionality. I generally find the DX of Redwood to be nicer, and more reminiscent of Rails, so maybe I’m biased but I think they really got a lot of things right.

Mostly I’m wondering if you can use RedwoodJS without running it as a server, and just pull in the types and classes.

Hi there! Just wanted to bump this thread one more time and see if this would be possible? I’d be very excited to try using Redwood’s more fluent API for accessing data.

@rob Is this question about the status or roadmaps for Redwood Record?

Check out the docs for RedwoodRecord and see how close it gets to the interface you’re looking for: RedwoodRecord | RedwoodJS Docs We don’t fully promote it since we consider it “experimental” but it definitely has more of the ActiveRecord-like interface that it sounds like you’re looking for, and since it’s class-based, has the extensibility you’re looking for.