Today I’m reflecting on the synergy between GraphQL and Typescript, and how it’s helped us to write better code here at Echobind. I recently wrote a case study for a client of ours and detailed how valuable these two pieces of technology were for our success. Below, I summarize the essential nature of the client’s challenges, and how GraphQL and Typescript set us up for success.
One of the core challenges of this project was the necessity for two separate applications, geared to serve two separate user demographics. Statistical data showed that one user group was typically a younger demographic in their 20s and 30s, and due to their comfort with technology and the mobile nature of their job, they would heavily favor a native mobile application. The other group tended to be a bit older and expressed a strong preference for a web application that would typically be accessed on a desktop computer in their home. The interactions between the native mobile app and the desktop web app would be numerous, as the app ecosystem needed to facilitate a number of features requiring input from both user roles such as messaging and interviewing. The challenge was how to ensure that the two applications communicated flawlessly from a technical standpoint while allowing developers to contribute to both platforms easily with minimal context shifting.
While GraphQL ensured both applications were externally synced on the same relations with the backend, Typescript ensured that both applications were internally synced. Using Typescript and some additional tools (namely graphql-codegen), we took the GraphQL schema and converted it into a set of data “types” that were stored in the frontend codebases. By keeping the types in the frontend applications up to date, we ensured developers always had the latest data and documentation at their fingertips (by means of their editors TS plugins), and that many potential bugs would be caught before the code ever even compiled.
The outcome was a robust and scalable application ecosystem that provided seamless interaction between the various user roles on their separate application platforms. The usage of Typescript ensured bugs were minimal in quantity and significance in both the web and mobile applications, and the GraphQL backend provided a solid foundation for not only the first iteration of the ecosystem but many future iterations to come. Scalability, clear documentation, and strong typing are some of the things Echobind loves about GraphQL and TS and keeps us coming back to them again and again for our best work.