COVID-19 Dashboard
This is for fun :)
Prerequisites
-
NodeJS
Install
yarn install --frozen-lockfile
Start for development
yarn start:dev
Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
Test the project
yarn test
Launches the test runner in the interactive watch mode. See the section about running tests for more information.
Test the project on CI
yarn test:ci
It will force to test all test cases and then quit once completed
Build the production bundle
yarn build
Builds the app for production to the build
folder. It correctly
bundles React in production mode and optimizes the build for the best
performance.
The build is minified and the filenames include the hashes. Your app is ready to be deployed!
See the section about deployment for more information.
run the production bundle
start:prod
You have to build the production bundle first
Demo
Please visit the dashboard here
Remarks:
-
The data (COVID-19 data) is from WHO
-
As the WHO restricts its data by using CORS, I used a proxy server to bypass the CORS
-
The country information is from REST Countries
-
The UI is powered by React and PrimeReact
Deployment
Prerequisites
-
AWS CLI 2+
-
Serverless 2+
Pre deployment (create cert)
As creat cert takes very long time, so, we should create the cert before everything
Besides, we have to create the cert in us-east-1
-
run
aws --region us-east-1 cloudformation create-stack --stack-name create-covid-19-dashboard-cert --template-body file://deployment/create-cert.yml --tags Key=project,Value=covid-19
-
Go to AWS cert manager page and validate the cert (add CNAME record in Route53)
-
wait for the validation to be completed
-
capture the ARN in the cloudformation stack output
Deploy infrastructure
we could run the serverless deployment to deploy the infrastructure
-
run
serverless deploy --stage prod --certArn {cert arn captured from above}
Deploy application
Most of the time we only need to deploy the application once the infrastructure is created
-
run
serverless client deploy --no-confirm --no-config-change --no-policy-change -no-cors-change