Building a Amplify Flutter for Web using a Serverless CDK Backend in Typescript with AppSync Merged APIs
In this post you will learn how to build a simple website using Flutter that interacts with a serverless backend powered by AppSyncs Merged APIs. the project will be deployed using CDK and comes with a CodeCatalyst workflow
Used technologies in this project
Using AWS AppSync - what are Merged APIs?
Writing infrastructure as code using AWS CDK
Setting up the serverless backend
Persistance layer & authentication
The CDK code for DynamoDB and Cognito
APIs - the AppSync setup and Schema
Setting up your Flutter project using Amplify SDK
Mixing it all together: Our CI/CD pipeline in CodeCatalyst
Developer Experience and a minimal Continuous Integration pipeline
Continuous Deployment and promotion using CodeCatalyst workflows
A community driven example project
What you learned and what you should take away from this article
Our web-page (build in Flutter) will be hosted on Amazon S3 behind Cloudfront. Cognito will be used for Authentication. AppSync will be our API endpoint and we'll connect to DynamoDB as a database. A few API endpoints will have Lambda functions.
In the project you will use the Flutter Amplify SDK to connect the Flutter application to the serverless backend.
pk
(primary key), the sk
(sort key) to access your data. The pk
needs to be unique across all of your data.The model additional access patterns, you can use the secondary index
gsi1pk
and gsi1sk
.This feature is very powerful for bigger organizations that have very segregated teams. Since v2.94.0 this is also supported by the AWS CDK with an L2 construct:
passThrough.js
function is a Javascript Appsync resolver that only passes through the request:getInformation
function accessed the DynamoDB table:flutter create frontend
. This will create an example application that has no connectivity to the backend.I would advice you to also use the Authenticator UI Library which simplifies the integration and avoids to implement the authentication/authorization flow.
amplifyconfiguration.dart
.This then concludes the implementation.
amplifyconfiguration.dart
for this project will look similar to this one: