This repository defines the serverless application architecture, resource configuration and infrastructure provision strategy of wasedatime.com.
We adopted a simple serverless application architecture, consisted of four layers: Presentation Layer, Business Layer, Persistence Layer and Admin Layer.
-
Micro-frontends hosting using multiple AWS Amplify Apps.
-
Micro-app routing in production environment uses path-based redirect configured through custom rules in AWS Amplify.
-
In develop environment, the domain of micro-apps are generated and injected as environment variables into the routing table of system-js during build.
-
Continuous deployment for each micro-app.
-
REST API service using AWS API Gateway with Lambda and S3 integration.
-
AWS Cognito for user authentication and management.
-
GraphQL API server using AWS AppSync
-
AWS DynamoDB as the main database
-
S3 stores static data and assets
-
Automatic backup is configured for critical tables
-
AWS EventBridge executes the scraper using CRON jobs
-
Scraper tasks are chained using AWS StepFunctions
-
Automated data pipelines triggered by S3
-
Integrates AWS Amplify, StepFunctions and CloudFormation status notification into Slack
-
AWS Budget plan and alerts
-
AWS CloudTrail for operation logging
This project uses AWS CDK as the IaC Framework. You need to install some modules of aws-cdk.
- Clone the repo
git clone https://github.com/wasedatime/wasedatime-backend.git
- Install NPM packages
npm install
- Obtain a .env file from the administrator and put it into the root directory.
The cdk.json
file tells the CDK Toolkit how to execute your app.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template