an offline-friendly, cache-first website frontend built with material ui, typescript, react and webpack with Jest unit testing
Highlights:
- Website deployed to an S3 bucket with Cloudfront as CDN: https://www.markz-portfolio.net/ and https://markz-portfolio.net/ are redirected to a CloudFront distribution. The CloudFont distribution is configured to redirect all
http
tohttps
. Some Cache-Control headers are configured for different built files of the React app for performance and cost. - SPA: all 400 class errors are redirected to /index.html by cloudfront.
service-worker.js
is used in a way that when new version is continuosly deployed to S3, a React snackbar displays notification, letting user choose whether they want to 'skipWaiting' and get the latest content. If they choose not to 'skipWaiting', the old content will remain on ALL TABS. This ensures cross browser tab data consistency.- Infra as code with
AWS CDK
here: https://github.com/MarkZhuVUW/aws-cdk-all - Currently the cost of maintaining the website is around 0.65usd per month.
- I call it a "higher-order react hook" that wraps the useReducer hook, and adds the ability to attach middleware and afterware.
- Inspired by Downshift and react-virtualized, I have decoupled all states into dedicated custom hooks while providing render props for allowing the customization of some parts the components
- Accessibility. All interact-able icons, button either have text within it or a unique aria-label.
In the project directory, you can run:
-
Runs the app in webpack development mode with live reloading.
-
Open http://localhost:4000 to view it in the browser.
Circle CI is used to test, build and serve the static React App to an S3 bucket on Master branch change.
try: