Sergey Nivens - Fotolia
Mobile development projects come with a particular set of challenges and complexities, which is why AWS has expanded its support and offerings in the mobile-backend-as-a-service arena with improvements to its Amplify platform.
AWS Amplify also supports AWS AppSync, a managed serverless offering that further extends the API capabilities of the descriptive query language GraphQL. These extensions include enterprise-level security, real-time data synchronization and back-end service orchestration.
The goal of Amplify is to improve overall development for cloud-based, serverless and web applications, and to offer a more structured approach to AWS mobile app development. Let's explore Amplify's revamped feature set and its support for GraphQL through AppSync. Finally, we'll tackle AWS Amplify vs. Google Firebase.
AWS Amplify basics
AWS Amplify has two main components -- the Amplify Framework and the Amplify Console. These components give users different ways to handle back-end deployment and functionality for mobile apps.
The Amplify Framework provides libraries and UI components for AWS mobile app development, which streamline the back-end and front-end build process. Developers can then use the framework to configure the services needed to power those back ends and couple them with any iOS, web, Android or React Native app.
Developers can also use the Amplify CLI and library for capabilities such as smooth provisioning of serverless resources, automated code generation and clear, structured methodologies to building data-driven apps.
The Amplify Console is a continuous delivery service that provides a unified development workflow for programmers to build and host single-page web apps or static sites. Used in tandem with the CLI, the Amplify Console simplifies provisioning and ensures continuous updating of back-end resources. Developers can check in changes via their source code repositories. Moreover, by accessing separate sandboxed environments, developers can choose when to merge new or updated functionality to their cloud applications.
How Amplify and AppSync rely on GraphQL
To better understand the ways that AWS Amplify and AppSync work together, you need to know how they incorporate GraphQL into the API build process. GraphQL is an open source data query and manipulation language. It offers a combination of schemas, data sources and resolvers to precisely define data queries. For example, if one wanted to build a relational database to track all the auto collision repair shops in a single county, and then within an entire state, it would require a substantial number of HTTP calls to gather pertinent data. Using AppSync and GraphQL, developers can build a single endpoint that can return the exact data that's defined with only one call. Developers can specifically describe the GraphQL schema to state the data types of all the fields used in the API operations. As a result, developers know in advance exactly what to expect when the data is returned.
GraphQL substantially reduces the number of endpoints compared to RESTful APIs. The dominant standard, RESTful APIs typically entail a high number of endpoints that can overburden the data querying process. This indiscriminate REST data gathering can lead to clients downloading more information than required and slower response times.
By contrast, GraphQL passes a query through a single endpoint, which enables more precise data retrieval. This eliminates the problem of over-fetching and under-fetching data, since each client indicates the exact data requirements to the GraphQL server based on the schema. GraphQL does have limitations for certain use cases -- for example, it lacks built-in web caching and can be overkill for simple apps -- but it's an efficient query language with widespread adoption.
AppSync with AWS Amplify capitalizes on this efficiency. For example, automatic code generation with GraphQL eliminates the burden of manually defining operations. Using the AppSync Management Console, developers can automatically generate APIs with all client-side operations present. In addition to faster code creation, developers also gain a more structured approach to designing and building data-driven applications.
AWS Amplify vs. Google Firebase
Google Firebase was first introduced as a backend as a service, and like AWS Amplify, it has since evolved into a multifunctional mobile and web platform. However, some key Firebase limitations become apparent when compared with AWS Amplify and GraphQL. The Firebase feature set has been augmented through Google's newest addition, Cloud Firestore, which builds on Firebase's original Realtime Database to offer a more intuitive data model for mobile app development.
While you can use both databases within the same Firebase application, Cloud Firestore supports new project development, offers more robust query capabilities and provides a more intuitive data model. The Realtime Database is ideal for mobile apps that require synced states across clients in real time.
However, the more data that's sent via read/write operations as well as the number of API calls will increase the costs for deployment of either solution. Moreover, a key prerequisite when working with the Realtime Database is to keep the data tree as flat as possible to avoid performance traps.
But as you add more features and data to an application, it can be hard to maintain that flat structure. Once an app has been deployed in Firebase, implementing further changes can increase costs, while organizing schema-less data simply adds to the IT burden.
In general, Firebase has limited support in comparison to AWS Amplify and the open source GraphQL community. The origins of Firebase as a real-time database can limit querying and performance capabilities. For example, unstructured JSON data within Firebase can pose significant issues as application complexity increases over time.
With GraphQL, developers can achieve high degrees of flexibility and performance with GraphQL. And as the number of server-side technologies increase, developers have a range of options to ensure continuous integration and to maintain their codebase over the long term.