TypeGraphQL and Apollo: Two Complementary Technologies in the GraphQL Ecosystem

Bilal Hankins
4 min readJul 16, 2021

What is GraphQL?

GraphQL was developed by Facebook after encountering issues with over-fetching data with RESTful architecture. This caused their mobile app to operate at slower speeds due to the many corresponding endpoints on one view. Out of this need for a better way to structure its own API, Facebook created GraphQL.

GraphQL is an API query language in which data is stored in one GraphQL endpoint that holds all the data needed for an application using custom-defined schemas and types for an application. The schema and type validation serves as a “contract” between the client and server to define what data is accessible on the response. Each schema has corresponding resolvers which are functions to be executed at runtime to retrieve the data.

Instead of making multiple concurrent requests to different endpoints on the server for data, GraphQL allows the developer to send a single query to the GraphQL server that allows the developer to define the fields in the schema needed using object types.

Growth Over Time

GraphQL has emerged as one of the fastest-growing trends in software development over the past few years.

This diagram depicts the increase in Stack Overflow questions tagged with GraphQL. As you can see GraphQL has been increasing in popularity exponentially year after year since first being released in 2015.

As GraphQL increases in popularity, developers need a well-rounded set of tools to allow for an efficient development process. In this blog post, I will discuss two crucial technologies and libraries that will allow you to optimize for efficiency and scalability when building GraphQL APIs.

TypeGraphQL

According to the official website, TypeGraphQL is a modern framework for developing GraphQL APIs with TypeScript in Node.js.

TypeGraphQL utilizes experimental decorators and TypeORM classes to define schemas in GraphQL.

The use of decorators and classes allows developers to not have to worry about redefining interfaces and type definitions whenever changes are made to a resolver. This allows developers to write GraphQL type definitions and schemas in a more efficient workflow and focus more on the business logic of the GraphQL API.

Apollo

The Apollo platform provides a vast arrangement of technologies that are supplemental and beneficial in your GraphQL API development. The two most popular are the Apollo GraphQL Server and the Apollo GraphQL Client.

Apollo Server is a production-ready GraphQL server that possesses the capability to connect to an Apollo GraphQL client as well as any other GraphQL client such as URQL. The Apollo Server in Node.js comes with a myriad of built-in features that can be configured to adhere to the scope of the application you are developing. Apollo Server can pull data from databases, microservices, REST APIs, and more.

Apollo Client is a state management tool that allows developers to manage local and remote GraphQL data in web, iOS, and Android applications. The official Apollo Client package supports Swift, Java, Kotlin, and React. There are community-maintained integrations for Angular, Vue.js, Svelte, and Ember.js.

Some companies that utilize the Apollo platform include PayPal, Peloton, The New York Times, Walmart, and Volkswagen.

Conclusion

Apollo and TypeGraphQL are two powerhouses in the GraphQL ecosystem. They are complementary technologies to each other but can also supercharge your GraphQL API.

Thanks for reading!

--

--