from Hacker News

Show HN: GraphQL Zero – AIs Mocking APIs

by evanmays on 6/27/23, 6:44 PM with 2 comments

I made an API mocking tool that imports a schema, populates fake data, then runs a local server. This is helpful for testing APIs or advanced prototyping.

A demo video is here: https://www.loom.com/share/abad2cdf325e4e0b9addea1e14406166?...

There’s two fun things about this tool

1. the complete lack of configs and schema annotations. i.e. you don’t need to learn faker-js. You just need your existing GraphQL schema and to to swap out the server URL in your frontend code.

2. the depth. Your fake objects have relationships to other fake objects. And in proxy mode, real objects can have fake relationships to fake objects

I built this on my journey to productize Backend GPT (https://news.ycombinator.com/item?id=34503418). I forked the open source GraphQL Faker project. Then added in so many LLM calls that it costs me $1 in OpenAI credits every time I process a schema. I learned from BackendGPT that without gating, many will use free OpenAI calls for their own ends (and those ends are often very weird). So this time I open sourced as much code as possible but put a small amount behind my server.

Next steps are supporting mutation mocking via code gen models and mocking other kinds of things (REST APIs, databases, etc) Open to any ideas here

  • by RicDan on 6/28/23, 7:02 AM

    This is a great use of AI! Im tasked with building a new platform and honestly one of my main head aches has been how to use the current AI power to facilitate development and maintenance. Whilst one use case is the automatic generation of edge cases for testing, another one was something like this, great to see it working! Any motivations to maybe add REST support?
  • by benjbrooks on 6/27/23, 10:18 PM

    this is sick!