What is Koa?
The team behind Koa has kept the framework as much independent as it can be without bundling too many middlewares for different tasks. At the same time, it has many inbuilt methods that vastly improve the way we write servers.
Koa GraphQL Boilerplate:
We at Xencov created a simplistic and slightly opinionated Boilerplate that gets you started with writing performant APIs without the need of setting up a project from scratch.
The boilerplate can be seen here: https://github.com/Xencov/koa-graphql-boilerplate
What is included in the boilerplate?
- Mongoose (MongoDB)
- JWT (Authentication) and other supporting modules that you can check on the GitHub repo.
How does GraphQL improves my API?
GraphQL may seem like an overhead initially but the real power lies when you start utilizing the API on your front-end whether its a mobile or a web app. GraphQL gives the power back to the client to only ask for the data it needs and nothing else from the API.
Lets take an example, you build an API for the home screen of your mobile app and the API is successfully integrated by the mobile app developer. Now the management wants to change the UI or add a new widget which needs some more data about the user. In a normal scenario, that would require the backend developer to make a change in the API to send the additional required data back to the client.
When using GraphQL, this change and additional development time could be saved because the client already has the power to get whatever data that is needed. You see how time-saving and easy that can be in scenarios when you have to maintain versions of your APIs due to such changes.
We will learn about the challenges that we faced in GraphQL in another blog.
Let me know if you have any feedback on the boilerplate. Feel free to submit a pull request to improve any aspect of it.