An unofficial, read-only Hacker News reader.

The Power of GraphQL, Without GraphQL (opens external site)

64 points by Shoetp 5 days ago | cobalt27.dev | 47 comments on HN

View full thread · View on Hacker News

Comment thread (4)

  1. As a counterpoint: while you and other people in this thread are talking about it mostly as a sort of enterprise-tool that helps impose discipline across teams, for me as a lone developer, I have found that schema-first GraphQL has helped me retain clarity.

    Because you can use the schema judiciously to avoid all sorts of problems and to help you visualise the API boundary much more clearly, and rethink it where you need it.

    I also find schema-first stuff quite useful in a prototype context. If I ultimately realise that there are fewer API flows that will matter, and I want to optimise for speed, I can embody those in a JSON API. It's also useful to lay down a framework to anticipate change in a networked app with internal APIs.

    But really any tool that centralises specifications in a way that drives code-generation is potentially a useful thing for a lone developer, because it helps you retain perspective.

    I use it less than I did, but I don't think I would benefit in the same way from this code-first approach from this library.

    Replies (1)
    1. Presumably your "REST-style" services that lie beneath GraphQL also have a schema, so it is not clear what GraphQL really adds if you don't actually have an organization graph to reflect. Navigating a graph of services is computationally inefficient so you'd only ever consider it if your people problems are greater than your compute problems, which was the case for Facebook with thousands upon thousands of developers all trying to work on the same project, but should never be the case for a small organization.
      Replies (1)
      1. > Presumably your "REST-style" services that lie beneath GraphQL also have a schema

        There aren't any "REST services" below the GraphQL layer. I am not using GraphQL as a service orchestration layer on top of REST services. Representing an organisation graph is not the only value of GraphQL.

        > so you'd only ever consider it if...

        > but should never be the case for...

        This is weirdly black-and-white and rather unimaginative thinking.

        I thought about spelling out a more detailed explanation of the situations where I think people miss out on the value of schema-first GraphQL, particularly in content flows or interpreted languages, as a lone developer building complex prototypes/proof of concept/v1 apps, but honestly the tone and tenor of comments here strongly suggests that it isn't worth the typing time. Like with any nuanced discussion of ORMs; HN has orthodox hatreds.

        It may be increasingly in the past for me, at any rate, because of LLMs.

        I don't know if gqlgen-style approaches make as much sense for LLMs because code generation is a significant indirection, and even an intensively schema-first approach like Laravel Lighthouse means asking the LLM to write in an additional language and manage the mapping. Good for me, not for the LLM.

        Plus I am moving on from all interpreted languages at the back end; it no longer makes any kind of sense to deploy PHP, Python or Node apps when you are responsible for the whole deal. The supply chain attack surface is too severe, the internet-facing attack surface is worse, etc.; it's just a recipe for lying awake worrying about the next shell vulnerability.

        Replies (1)
        1. > There aren't any "REST services" below the GraphQL layer.

          We did already discuss that other uses emerged, but it was originally designed to have "REST-like" services behind it. I mean that's cool if you found some other use for it, but that isn't what it was designed for or what we were talking about.

          > I think people miss out on the value of schema-first GraphQL

          That's possible, but I don't think you've made the general value proposition of a dynamic graph system clear. In my experience, if my application has simple boundaries, which is most apps, then there is no meaningful graph traversal to speak of and if my application is complex and does have a need for graph-like structures then things like the n+1 problem still make leveraging it impractical. I don't think many are working on systems that are truly graph problems and optimized for such. If you take away the graph dynamism then there are much better schema tools and always has been.

          > I don't know if gqlgen-style approaches make as much sense for LLMs

          There is no avoiding Conway's law, so that depends on your organization structure. If LLMs have changed how your organization functions then it is possible that whatever value you saw before no longer applies, but it is likely that Facebook's problems GraphQL was created to solve remain. LLMs aren't exactly magicians.