5
4 Comments

Ask IH: GraphQL, did you use it or do you plan to use it?

Calling all indie hackers to share their story / experience using graphql.

  • Why did you choose graphql?
  • What's your graphql tech stack?
  • What did you learn?
  1. 2

    Hey there! I haven't used GraphQL for a startup yet, but we do use it for our new project at work.

    What's your graphql tech stack?
    FE: Elm, elm-graphql for type-safe always-valid queries
    BE: Typescript, Graphql Yoga, Prisma

    Why did you choose graphql?
    Prisma is cool af.

    Prisma was new to me when I was starting with the project, but it is the real difference maker in this tech stack. It is an ORM-like database wrapper that lets you interface with the database in GraphQL. If you haven't used SQL much, this approach feels a lot more natural and comprehensible. It has neat tools too, like a playground, and one-line deploys. My experience with it has been wonderful so far!

    What did you learn?

    1. Caching BE responses is going to be quite a headache with GraphQL (we are currently trying to implement it).
    2. GraphQL tooling is mature enough (but could be better) and is evolving rapidly.
    3. The thing is quite new, so good documentation is hard to come by.
  2. 2

    Why did you choose graphql?

    I read a lot of positive things about it.

    What's your graphql tech stack?

    FE: Apollo
    BE: Absinthe(Elixir)

    What did you learn?
    Lots? I've read a few books and taken two video courses on it to find ways to better use it. Not sure what you're looking for with this question though so can't really be specific.

  3. 1

    I'm using GraphQL in my project and I can tell you it is great, and in a lot of cases better than REST. It saves you a lot of time specially with stuff like pagination, security, multi-query, etc. Also you have to be careful defining your types and the relations within them, specially when working with permissions.

    Why did I choose it?

    • Because it is the best.

    What's my GQL tech stack?

    • Frontend: Angular/apollo
    • Backend: Django/graphene

    What did I learn?

    • GraphQL is a good point to start if you are start learning APIs stuff. It teaches you good practices when building APIs.
  4. 1

    Why did you choose graphql?

    I just wanted to try it. I was unhappy with a de-facto CRUD aka REST APIs industry standard.

    What's your graphql tech stack?

    FE: custom
    BE: graphql-tools (Apollo)

    What did you learn?

    From my point of view the best (not obvious) parts are:

    • explicit schema, which forces you to think about your API and also enforces the contract,
    • separating queries, mutations, and subscriptions which forces the CQS principle,
    • separating Types and Inputs which prevents from CRUD-like APIs by default,
    • clients are forced to explicitly enumerate all fields they are using, which makes easier to evolve schema and makes refactorings less painful.

    In my case adopting GraphQL reduced around 80% of boilerplate code connected to validations, error handling, endpoint mappings, data joining, etc.

    I'm rather skeptical about the hype around new technologies, but in this case I can honestly recommend GraphQL.
    There is one caveat, however. With GraphQL it is very easy to fire big queries that will be translated into many DB queries in the backend. Watch out for those. Check out this library which may help in such situations:
    https://github.com/facebook/dataloader