Has GraphQL improved? I literally can't fathom using some kind of external plugin just to load data using more complex queries for performance reasons.
Depending on the framework that use for your DB-to-GraphQL layer (like Hasura / join monster/ PostGraphile / subZero etc) there can be some there can be some limitations on what it can and cannot do, but that is not really a GraphQL problem.
The GraphQL specific gotchas for me where
- For most part component level queries works well, occasionally batching in higher component is important for performance, for example instead of executing a secondary query on each row of the table ( say fetching photos of user profiles from a different store) doing it one level up can speed things up.
- Caching has to be solved very differently than RESTful APIs, GraphQL has everything in one endpoint as POST and you cannot leverage CDN's to cache the canonical resource URLs
- Less verbosity or nested request-responses could be important for UX performance, using HATEOS style discoverability usually results in many APIs calls 2-3 levels or more deep, in RESTful systems that is not a major problem as you are caching API responses in nodes in dozen locations/CDN PoPs near the user but that is not possible in GraphQL, so you have to keep mind of verbosity, that can also impact how you store and index your database and how you configure and run replicas etc at scale.
---
Anecdotally I have used Hasura as GraphQL frontend for an existing mature PostgreSQL db and APIs, (1 tb+, 1000's of concurrent users), and it scales fairly well even with 4-5 level nested joins or fetch ten of thousands of nested records. Hasura also does subscriptions reasonably well and they don't use triggers for implementing it.
Some areas that needed a bit work around for me - recursive CTEs, cross-db joins, performance of very large counts ( postgres problem - using HLL or tuples from the planner if approximate values are fine.
You can also join additional data to reference in deeper resolvers, but that's an antipattern AFAIK.
Lack of updates also isn't necessarily an indicator of disuse. It currently has close to 5 million weekly downlaods, roughly 1/5th of express which is probably the most popular library for building APIs in node.
query {
myCustomQuery(...params...) {
id
whatever
}
}
backed by async function resolver(ctx) {
const rows = await db.query(sql`SELECT yadda as id, badda as whatever FROM dabba JOIN dada ON ...`);
return rows;
}You could validate against having too many layers of nesting in one query, validate pagination, provide abstract relationships for the many nesting and special case those joins, etc.
It's basically a question of how to efficiently query data. There's always ways, but it might require some trimming of allowed graphql queries.
The GraphQL Server in RedwoodJS does query depth limiting out-of-the-box. You can configure it, but by default the depth is 11 -- because all the best things go to 11.
API listening on http://localhost:8911/
api | GraphQL endpoint at /graphql
api | 15:23:32 Server listening at http://[::]:8911
web | <e> [webpack-dev-server] [HPM] Error occurred while proxying request
localhost:8910/graphql to http://[::1]:8911/ [EADDRNOTAVAIL]
(https://nodejs.org/api/errors.html#errors_common_system_errors)
web | <e> [webpack-dev-server] [HPM] Error occurred while proxying request
localhost:8910/graphql to http://[::1]:8911/ [EADDRNOTAVAIL]
(https://nodejs.org/api/errors.html#errors_common_system_errors)Redwood Forums: https://community.redwoodjs.com
Redwood Discord: http://discord.gg/redwoodjs
?
Thanks!
[::] -> [::1]Although it's not a typical for-profit business model, we are sustainable and will enthusiastically continue building Redwood to v2 and well beyond.
You can read more about all of that in today's blog post from Tom (aka mojombo): https://tom.preston-werner.com/2022/04/04/redwood-v1-and-fun...
> So my million dollar spend on Redwood development comes with no strings attached, except that we continue to focus on building the best app framework for startups.
It's a personal investment and a passion project. Unless they're lying, there is no business model.
> Although it's not a typical for-profit business model, we are sustainable
If it’s sustainable, there's clearly something other than a one-off donation. What is it?
Netlify is competing with Vercel that has Next.js. So basically RedwoodJS was built to sell more Netlify hosting plans the same way Next.js was for Vercel. It is therefore safe to say that RedwoodJS will continue to exist as long as Netlify is a thing... unless Next.js completely owns the market and RedwoodJS's reason to exist makes no sense because of too few users.
Congrats, it looks damn awesome.
Can't help but giggle at the downvotes.
/s
Hacker News logic 101.
Man, this field really does move quickly.
Lesson One — Building and Bundling are hard but don't make it harder.
We (by that I mean Peter and Danny) took a hard look at new tools, and, well, they let us down. We reverted a few steps that took us months to figure out. But we learned. And someday we'll make a move to different tooling. But in our opinion, those tools are not ready yet. (Side note: I read a tweet about how buggy SWC is with Next. Anecdotally, although we're stoked for the future of SWC, it remains as a draft PR yet to be merged in the Redwood Repo. We also reverted the primary part of our ESbuild implementation. So the tweet jived for me with our experience.)
The hype is all about speed and performance. But I think the reality is fairly simple:
- implementations become unintelligible spaghetti over time
- everyone has been burnt by having to manage this themselves
- poor implementations lead to diminishing performance
Turns out the existing tools are fairly robust. But to use them we spent an epic amount of time tuning and refactoring. It's complex. But it isn't broken. If you're willing to let good enough be good enough, set a benchmark, hit it, etch it in CI, and call it good.
Lesson Two — Let go but pin the packages
Note: We chose to have @redwood packages include all the dependencies and config and integration under the hood. Redwood apps have very little package overhead out of the box. This means we have to tame the dragon behind the scenes.
The "cool kids" seem to be moving to pnpm (and/or Yarn pnp). I've been burned many times by the monstrosity that is node_modules, but, to be fair, it's also fairly incredible what we're able to achieve. I don't think any one package manager is going to be the cure for what ails us. But I do think it's possible to MakeItWork regardless of what you choose:
- pin your packages because the dependency of your dependency is your enemy
- lean hard into CI; then lean harder
- stay current; give in and let Renovate update
Yarn 3 is a phenomenal tool. (Plus the core team is top-notch.) And we're not even using pnp yet. We do have a long way to go and yes, a faster install would be great and a smaller size on disk and etc. and etc. But, again, I think people have been burned by having to figure it out themselves and finding things unmaintainable in the long run.
---
I'm tired and likely not making much sense anymore. I might have lost the thread, but I think the overall point I was trying to get to is this --> zOMG I'm so tired of talking about build tools and package managers and chasing incremental performance gains and can't we just focus on features that move the needle and have fun again? Oh, and PIN your damn packages 'cause that "^" is nothing but trouble!
Thank you and good night.
:)
Could you maybe provide a better argument for why you think we’d all have moved on by now? Aside from ‘wow its not as new as the new thing’?
this moment with postgres, node, webpack, babel, scss, and react feels off in a way. there are genuinely more capable alternatives to all of those that take less time to learn and work effectively with, perform better, cost less, and are trusted by big institutions. rails never felt this entrenched when it was the leading default, for example.
there are a lot of positives to this that non-web engineers have seen for a long time--education becomes better and more accessible, people can have more stable and successful careers, and groups can take on more ambitious missions--it's just surprising from how i've seen web engineers approach their trade over the past 15 years
What would you recommend instead o yarn and webpack?
I have been using vite and npm in my small frontend projects.
There's nothing wrong with webpack except its lengthy build times. It's not a knock on webpack, it's more a knock on using JavaScript (node) for everything. Vite uses esbuild which is coded in Go. Next.js adopted swc (Rust) and hired the lead.
I recommend Next for large react apps and vite for apps that would otherwise use create-react-app. Obviously if you're doing Vue, use vite.
With Redwood, no one has to go it alone.
If you have any questions along the way, don't hesitate to reach out to me. I'll be watching comments here. And my DMs are open everywhere.
Join the Redwood Community: https://redwoodjs.com/community
So very excited to see what people with Redwood