2020-02-26
2864
#graphql
Leonardo Losoviz
14569
Feb 26, 2020 ⋅ 10 min read

Code-first vs. schema-first development in GraphQL

Leonardo Losoviz Freelance developer and writer, with an ongoing quest to integrate innovative paradigms into existing PHP frameworks, and unify all of them into a single mental model.

Recent posts:

Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 ⋅ 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 ⋅ 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 ⋅ 11 min read
Using Aws Lambda And Aws Cloudfront To Optimize Image Handling

Using AWS Lambda and CloudFront to optimize image handling

Leverage services like AWS Lambda, CloudFront, and S3 to handle images more effectively, optimizing performance and providing a better UX.

Nitish Sharma
Apr 12, 2024 ⋅ 12 min read
View all posts

4 Replies to "Code-first vs. schema-first development in GraphQL"

  1. Great read. I’ve worked on a Typescript/Rails schema first approach application. Now working on a restful Typescript/Laravel service and I’m missing the graphql schema. Im interested in trying a schema first approach. I hope it’ll be a tool allowing backend & frontend dev to collaborate more. The risk I see in a code first approach for speedy changes is the impact on all the integrated systems. Working in a code first approach is enabling the backend dev team to make all design decisions. Depending on your team this may be great. I think this ties into your first point about schemas being a communication tool. Theres one way I’ll find out 🙂

  2. “Im interested in trying a schema first approach. I hope it’ll be a tool allowing backend & frontend dev to collaborate more.”

    Have your tried playing with https://graphqleditor.com/ ? Looks like we might have what you are looking – live collabroation, schema libraries, visual representation as well as mock backend an some more features 🙂

  3. I did both, schema and code first approach (using NestJS). While it is easier to write the contract using the schema, it is much more convenient to then implement the resolvers using the code first approach. So to summarize, I first wrote the gql schema and then wrote the corresponding classes with decorators (code first), once done I dropped the schema.

  4. SDL First or Code First, you can still API First and Schema First. Using “Schema First” to name the act of using SDL to define your API/Schema First is poor naming. The real issue is, you can use SDL or Code to define your API/Schema First, choose the one that makes the most sense for you. The value of API/Schema First design principle is still valid and great practice regardless of it you choose SDL or Code First to is define the API.

Leave a Reply