The new Schema Prototyper

Hi everyone and nice to meet you all!

We are The Guild and we are happy to say that we’ve recently finished the first version of Schema Prototyper grant proposal.

Background

The idea and reasoning behind the Schema Prototyper was to create a tool for easier collaboration for creating subgraph schemas.

The tool could be hosted anywhere, also online, so anyone could jump right into it without setting up anything.

Also the tool could mock schemas, run lint rules to make sure all schemas conform to The Graph standards, multiple people could collaborate on it with real time syncing and many more features.

Here is a link to the original proposal

Who are we?

The Guild is a group of open source maintainers and individuals who are maintaining the most popular libraries in the GraphQL Ecosystem - libraries like GraphQL Mesh, GraphQL Code Generator and many more.
You can read more about our philosophies and the way we work here.

We’ve recently joined The Graph community and are very excited about the solutions that are already built and want to see how we can participate, help and collaborate!

What we’ve done so far?

The first part of the task was to create a GraphQL aware Monaco editor.

We wanted to base our editor on the official GraphiQL’s version of it, but there were a couple of missing things and issues there.

So we’ve forked the GraphiQL and GraphQL Language Service monorepo, made a couple of updates and fixes to the Monaco integration and extended the Language Service to make it aware of the GraphQL schema in the editor, and updates in real time with validations, custom checks, language and type awareness.

We’ve also added schema browsing and made the editor highly extensible with both high-level and low-level API for creating custom GraphQL-aware editors.

You can find the new editor here and try it online here.

We’ve also recently joined the core maintainer of GraphiQL so soon enough we will merge all these changes into upstream GraphiQL and GraphQL Language Server.

We’ve also added linting rules to the schema prototyper thanks to our own graphql-eslint open source library.

After that was done, we’ve move to add Real-time collaboration features.

For that we’ve used the YJS Protocol over WebRTC. You can find the code here.

Web2 and Web3

The next part was to work on persisting the schema and creating the infrastructure to run it.

For both we’ve created two versions, which the editor could switch between them easily - a “web2” stack solution and a “web3” stack solution.

For persisting the schema on the web2 version we’ve used FaunaDB and for the web3 we’ve used ThreadDB.

All storage is being routed by a simple API route to switching between solution types is easy.

In terms of infrastructure, the web2 version is using Next.js to host the frontend and the Backend API on Next.js API routes.

For the web3 version the frontend is stored on Fleek and the backend API on Next.js API routes.

What’s next?

Some of the next things we want to add to the editor are:

  • Mocking - You could execute operations against the schema with fake data from within the schema prototyper (which should be relatively easy thanks to the existing open source libraries we already have)
  • Hinting - We’ll create more custom graphql-eslint rules so you could get hinted on best practices for designing the best possible schema
  • Integrating into The Graph tools and websites - We want to deploy the Schema Prototyper in the places that could help the community
  • Feedback from The Graph community and the GraphQL community - This is a first version. Now we want to hear from you, and from the GraphQL community, what else this tool could and should do! - Go try it out here and here is the GitHub repository

The Graph and The Guild

This is a first step for us to get into The Graph community.

The experience of working with and on Web3 technologies has got us very excited about the possibilities and the bright future to come.

We are already in contact with The Graph Foundation about larger scale collaborations, in areas such as subgraph composition, mutations and many other things.

The future is looking bright, thank you all for welcoming us into the community!

7 Likes

Regarding the schema prototyper I think two features would be very useful for async collaboration:

  • Comments
  • Suggested edits (like in Google Docs)

Discussions about schemas are often like: "I would use Bytes here as a type and not String". or “Why do we need to have this relation here? Couldn’t it be done with just an array?”. Facilitate such discussions with the relevant context would be very helpful in my opinion.

1 Like