Yesterday, GraphQL Taiwan meetup hosted by GraphQL Taiwan took place in Taipei, Taiwan, around 50 participants attended. As CTO of Canner, I'm glad to share what our team Canner's experienced with GraphQL on this meetup.
What's in this talk?
At first, I shared about how we see CMS at Canner, and why GraphQL plays a big part in our development stack.
1. CMS Background - The reason to use GraphQL
Due to the demands of the displaying content on different devices (website, mobile, tablet, IoT... ) and the rising popularity of frontend framework (such as React, Angular, etc...), more and more developers shifted from traditional CMS to headless CMS.
However, we also noticed that many developers started to use BaaS (Backend-as-a-service) and there are many features overlaped between Headless CMS and BaaS. What Headless CMS can do, BaaS can do even better, such as API, File Storage, Cloud Function, etc...
This is why we started a concept - Adaptive CMS. The concept soon became our product - Canner.
We believe GraphQL would be a good solution in order to deal with different data sources and data relationship at our framework.
2. Why Canner select Apollo?
After several days of research on GraphQL, we decided to use Apollo for several reasons:
- Great Documentation.
- Great Development Experience : apollo-client-devtools
- Great support for React and Typescript.
- Flexibility by using Apollo-link.
- Clear implemetion about Cache machanism in Apollo-client.
3. Integrate with Firebase: Apollo-link-firebase
Several months ago, we announced apollo-link-firebase.
apollo-link-firebase provides you a simple way to query Firebase in graphQL with Apollo-client without building a graphQL server.
Currently, we support features below:
- Query: All sorting and filtering methods on document are supported.
- Mutation: deal with set, update, remove methods with graphQL mutation.
- Realtime Subscription: Listen to your Firebase events using graphQL Subscription.
- Data Join: Retrieve your data from different paths using one graphQL.
4. Canner with GraphQL
While designing graphQL interface for our CMS framework, I saw prisma just released. Prisma is a performant open-source GraphQL ORM-like* layer doing the heavy lifting in your GraphQL server. They designed a great graphQL interface that we can just use it in our CMS framework.
Hence, our team Canner developed almost the same graphQL interface with Prisma in Typescript and written as an apollo-link. Although we haven't officially announced this repo, but it's already on github: canner-graphql-interface.
canner-graphql-interface provides a connector interface, so we can simply implement this interface to create connectors to different data sources, which is now support for Firebase Realtime database, MemoryStore and also Prisma Client. We'll be sure to support more data sources in the future.
In the last part of the talk, I shared some difficulties when we connect Canner to Prisma. There are some issues about data type transformation between Canner and Prisma.
That's all for the recap of my talk. Hope to see you next time.