8/31/2021 API Gateway Rest APIs data syncing | Uclusion
Roll your own versus existing GraphQL
implementation for PWA
David Israel Follow
May 23, 2020 · 2 min read
Uclusion has a PWA client that needs to
1. Keep a local data store in sync in a React app
2. Have back end extensive business logic
3. Store to a back end database
How much of the heavy lifting do we have to do? For instance what if we use AWS
AppSync? Well according to this post from 2018 that would require writing our
business logic in Resolver Mapping Templates. I don’t see anything in the
documentation to suggest that has changed and those templates are written in Apache
Velocity Template Language (VTL). So that’s a no on AWS AppSync unless you are
willing to have your business logic in the front end or use VTL.
What about Firebase? Looks like the same basic problem according to the
documentation:
For mobile and web client libraries, use Firebase Authentication and Cloud Firestore
Security Rules to handle serverless authentication, authorization, and data validation.
Learn how to secure your data for the Android, iOS, and Web client libraries with Cloud
Firestore Security Rules.
For server client libraries, use Cloud Identity and Access Management (IAM) to manage
access to your database. Learn how to secure your data for the Java, Python, Node.js, and
Go client libraries with IAM.
https://medium.com/uclusion/roll-your-own-versus-existing-graphql-implementation-for-pwa-a076889e29b9 1/2
8/31/2021 API Gateway Rest APIs data syncing | Uclusion
Cloud Firestore Security Rules look to be a VTL equivalent and so are out. IAM seems to
control, at a granular level, what operations a client can perform but that’s not the
same as being able to run business logic on each operation.
Further Googling shows that GraphQL platforms in general might have this opinion.
For instance Apollo GraphQL says:
REST APIs are not a good fit for modern apps because they require large amounts of hard-
to-manage data fetching code.
Its all about read and no mention of write. Extensive business logic may not fit easily
into an architecture designed for fetching data.
I welcome comments from users that have found a platform where they didn’t have to
write the sync layer but still were able to program business logic freely. Its certainly not
wine and roses on the roll your own side either as Uclusion had to go to a LOT of
trouble building a layer to keep data in sync. We will be exploring how we did that in
later posts.
What we can say for certain is that AWS API Gateway is fairly mature technology
available for Rest APIs. Yes you could use an API Gateway to shoe horn in your own
GraphQL as this blog does but GraphQL without an out of the box data sync
implementation is like autumn leaves — pretty but missing essential functionality.
About Write Help Legal
Get the Medium app
https://medium.com/uclusion/roll-your-own-versus-existing-graphql-implementation-for-pwa-a076889e29b9 2/2