4 ms·
I'm inclined to agree. This is nothing against the OP but I never reach for boilerplate generators, even ones like `create-react-app`. Here's a great example o
by qudat 6y ago
I'm inclined to agree. This is nothing against the OP but I never reach for boilerplate generators, even ones like `create-react-app`.
Here's a great example of why: I do a bunch of research before I started my project (https://listifi.app https://listifi.app - for anyone curious) and decided to go with prisma.js. It looked like it was exactly what I wanted for a REST API built with koa.
I've dumped probably a month fulltime on the project and now that I have enough experience using prisma, I realized it really doesn't do what I want it to do and is actually making my life more difficult as a result.
So now I'm in the process of switching from prisma to knex. Having the glue hidden from me would really affect my willingness to switch technologies and increase my frustrations with any platform.
For any reasonably complex application, you will eventually need to eject.
I want to see how everything is pieced together. Even these js builders like parcel that "do everything for you" eventually don't work.
I'll take a couple of days to set things up the way I want them to over something that tries to do it all for me while only accommodating the happy path.
Again I want to say that this is my personal preference when building any project. I pick a few barebones libraries to help me build what I want and get out of my way.
That should be obvious when you look at my tech stack: https://listifi.app/u/erock/listifi-tech-stack https://listifi.app/u/erock/listifi-tech-stack
- thatwasunusual 6y agoCan you describe the problems you've encountered with Prisma? I'm in the process of choosing an ORM myself, and Prisma seems to be the best option of those I've tested.
- qudat 6y agoI’m not a fan of ActiveRecord or ORMs in general. I’d much rather write raw sql queries with a little help to improve reusability. I found Prisma to be super basic. Anything complex like joins or a composition of where’s and ors and it didn’t work. It also nests related objects where for my purposes I wanted everything to be flat. So if a list has a user associated with it, I want to flatten it like: { list, user }. I also didn’t like how Prisma has a generate cli to integrate end developer models that must be integrated into your build step to deploy if you’re using typescript. Its schema cli command worked but in weird ways that I didn’t like. Sharing Prisma types with the client was not automatic. For example, Prisma coverts datetime columns into dates, which sounds nice, but when I send that data as an api response it turns into a string. Now I can’t use their interfaces without plucking the date times and converting it to a string. It just wasn’t as useful as I had hoped. Knex does exactly what I want and nothing more. All of my raw sql queries were easily converted and worked perfectly. I build the interfaces and knex uses them. There’s no special command that converts their schema format into something I can kind of use. Their typing was nice once I got it working however, and for simple things it worked fine. I just noticed I had to write a lot of raw sql. A lot of people like it so don’t let me critique shy you away from using it. It probably works best if you are using graphql since it automatically nests the models which I would imagine works well with query resolvers.
- thatwasunusual 6y agoI appreciate your reply!
- Glyptodon 6y agoI'm curious what you don't like about Prisma? I like Active Record + Arel (from Rails) a lot, and have found Knex relatively unpleasant in comparison, offhand Prisma has looked more pleasant/usable to me...
- qudat 6y agoThis is where our preferences probably differ. I’m not a fan of ActiveRecord or ORMs in general. I’d much rather write raw sql queries with a little help to improve reusability. I found Prisma to be super basic. Anything complex like joins or a composition of where’s and ors and it didn’t work. It also nests related objects where for my purposes I wanted everything to be flat. So if a list has a user associated with it, I want to flatten it like: { list, user }. I also didn’t like how Prisma has a generate cli to integrate end developer models that must be integrated into your build step to deploy if you’re using typescript. Its schema cli command worked but in weird ways that I didn’t like. Sharing Prisma types with the client was not automatic. For example, Prisma coverts datetime columns into dates, which sounds nice, but when I send that data as an api response it turns into a string. Now I can’t use their interfaces without plucking the date times and converting it to a string. It just wasn’t as useful as I had hoped. Knex does exactly what I want and nothing more. All of my raw sql queries were easily converted and worked perfectly. I build the interfaces and knex uses them. There’s no special command that converts their schema format into something I can kind of use. Their typing was nice once I got it working however, and for simple things it worked fine. I just noticed I had to write a lot of raw sql.
- matthewmueller 6y agoCurious about the date response part. JSON.stringify(payload) turns dates into strings. Did that not work as a response for your API for some reason?
- qudat 6y agoIt works fine, but the typescript types that prisma generates says that type is a date, not a string. So I can't directly use that as the API response type, I have to modify the prisma type to get it to work correctly on the FE. Does that make sense?