The Backend Application contains API code for the Micro-Frontend Application along the infrastructure as a code for creating AWS resources.
API Code is written in NodeJS and deployed on AWS Lambda. APIs are responsible for creating and updating records on the DynamoDB Table.
Infrastructure automation is performed using AWS CDK written in Typescript. CDK contains the code for AWS resources (AWS CodeCommit Repository for Backend app and Micro-Frontends, AWS CodeBuild, AWS CodePipeline, AWS DynamoDB).
| API | HTTP Verb | Purpose |
|---|---|---|
| /charts/:id | GET | Leveraged to get chart data for a user |
| /charts | POST | Leveraged to update/create chart data for a user |
| Key | Data Type |
|---|---|
| userId | Sting(PK) |
| cameras | Number |
| chairs | Number |
| jeans | Number |
| mobilePhones | Number |
| shirts | Number |
| shoes | Number |
| tables | Number |
| wardrobes | Number |
| Resources | Purpose |
|---|---|
| AWS CodeCommit | Code Repository for Backend App and Micro-Frontend Apps |
| AWS Build | Leveraged for Building and Deploying code on AWS Lambda function |
| AWS CodePipeline | Leveraged to automate release pipeline |
| AWS Lambda Function | Leveraged to deploy backend code |
| AWS API Gateway | Front door and trigger for Lambda Function |
git clone https://github.com/aws-samples/micro-frontend-using-polyglot-javascript-frameworks.git
cd micro-frontend-using-polyglot-javascript-frameworks/backendnpm installnpm run build:lambdaBootstrap environment is requried only for the first time when are running CDK on the AWS account. Bootstrapping creates resources that may be needed to deploy your stack like an Amazon S3 bucket for storing files and IAM roles that grant permissions needed to perform deployments.
cdk bootstrapnpm run deployOnce the CDK deployment is successful, go to the cdk-outputs.json file present in the backend app, and copy the value of "APIGatewayURL". We would need API URL for the frontend apps.
After completing the Backend App deployment, we can proceed with the Frontend Applications deployment.
Let's deploy our first Micro-Frontend app, Angular Charts App.
