GraphQL Nexus Enhances Code First Capabilities for GraphQL API Development

During the Thursday session of the 2019 GraphQL conference in Berlin Germany, Tim Greisser, Software Engineer at Cypress.io, presented the benefits of using GraphQL Nexus for taking a “code first” approach to GraphQL API development. GraphQL Nexus is a development library that allows GraphQL developers to do strong-type programming when creating a GraphQL API.

For many developers creating APIs using the standard GraphQL Schema Definition Language (SDL) in conjunction with a Javascript-based framework such as Apollo Server is an error-prone undertaking. Loose-type languages such as JavaScript check for syntax and type declaration errors at runtime. As a result, simple typing mistakes can cause problems that go undetected until the code is released to production.

GraphQL Nexus uses TypeScript as the foundation of its development experience. TypeScript allows developers to program using classes, interfaces, and generics in a manner found in formal Object-Oriented Programming languages such as Java, C# and C++. Typescript enabled development platforms such as Visual Studio Code to perform type checking as developers write code. Thus, errors are uncovered immediately.

GraphQL Nexus provides an SDL Converter tool that will transform GraphQL schemas written in SDL into TypeScript.


Nexus SDL Converter transforms GraphSQL schemas written in Schema Definition Language (SDL) into TypeScript

Also, the project published the online Nexus Playground. Developers can use Nexus Playground to get direct hands-on experience working the GraphQL Nexus features such as autocomplete and syntax checking.


Nexus Playground allows developers to get hands-on experience programming a GraphQL API in a fully functional integrated development environment.

During the talk, Griesser pointed out that the goal of Nexus is to allow developers to create better code at faster rates by taking advantage of the power and safety that code-first programming promoted by Nexus facilitates.
The Nexus is published as an open source project on GitHub. The GitHub repository found here also provides a variety of examples that demonstrates the capabilities of Nexus. 

Be sure to read the next API Design article: How Intuit Designed its API Ecosystem For Both Internal and External Success

 

Comments (0)