The CV is written as a ReactJS website which is accessible at cv.crisboarna.com and has a Download button to save a pdf of the CV.
Short behind the scenes
Website is hosted on S3 accessed onl by Cloudfront CDN via OIA. You can view the architectural diagram at the bottom of the page.
Lambda runs a custom runtime Docker container based on Lambda NodeJS AL3 environment. This is done to ensure local and remote environments are identical.
This container runs a headless Chrome browser via Puppeteer which loads the CV live page at https://cv.crisboarna.com, uses Chrome inbuilt PDF printing feature to generate the PDF.
This has the added benefit of
- Ensuring the PDF has selectable text that is extractable
- Has a standard rendering viewport that is not reliant on client
During the CDK Web stack deployment, the above Lambda is called and via Cloudformation Custom Resource and places in S3 the generated PDF to be available on-demand for download to reduce download latency and reduce costs, having to invoke the Lambda only once.
Languages and tools used 0. Docker
- Typescript
- AWS CDK
- ReactJS
- Webpack
- Nx Monorepo
You can use nx docker:run exporter for testing locally the PDF generation to S3/local directory.
Testing
Jest is used for exporter and web.
Jest & AWS CDK Assertions is used for infra.
yarn installnx serve webnx docker:run exporterAlternatively, in the .run folder there are run configurations for running the exporter from IntelliJ.
Build can be triggered across all services (exporter,infra,web) by running
yarn buildAlternatively each can be run individually via one of the commands
nx build exporter
nx build infra
nx build webLinting can be triggered across all services (exporter,infra,web) by running
yarn lintAlternatively each can be run individually via one of the commands
nx lint exporter
nx lint infra
nx lint webNote
Infrastructure CDK code is linted with eslint and cdk-nag, the CDK equivalent of Cloudformation cfn_nag to ensure standard & best practice adherence by IaC.
Other apps are linted with eslint.
Tests can be run across all services (exporter,infra,web) by running
yarn testAlternatively each can be run individually via one of the commands
nx test exporter
nx test infra
nx test webTesting coverage is enforced globally via the individual jest.config.js as follows
Exporter
| Category | Minimum |
|---|---|
| Branches | 100% |
| Functions | 100% |
| Lines | 100% |
| Statements | 100% |
Infrastructure
| Category | Minimum |
|---|---|
| Branches | 100% |
| Functions | 100% |
| Lines | 100% |
| Statements | 100% |
Web
| Category | Minimum |
|---|---|
| Branches | 76% |
| Functions | 82% |
| Lines | 87% |
| Statements | 87% |
Single command
nx deploy infraIndividual components in order Note Deployment order is important as subsequent stacks have dependencies on previous ones.
cdk deploy -a 'npx ts-node --prefer-ts-exts -P apps/infra/tsconfig.app.json -r tsconfig-paths/register -r dotenv/config apps/infra/src/bin/ECR.ts'
cdk deploy -a 'npx ts-node --prefer-ts-exts -P apps/infra/tsconfig.app.json -r tsconfig-paths/register -r dotenv/config apps/infra/src/bin/Exporter.ts'
cdk deploy -a 'npx ts-node --prefer-ts-exts -P apps/infra/tsconfig.app.json -r tsconfig-paths/register -r dotenv/config apps/infra/src/bin/Web.ts'or simpler, with build included
nx deploy:ecr infra
nx deploy:exporter infra
nx deploy:web infraThese are the diagrams of all resources and their connections as generated by cfn-diagram from the CDK source code.
To generate the diagram on the fly while tweaking the infrastructure run
nx diagram exporter
nx diagram layer
nx diagram web- Clone repo and create a new branch:
git checkout https://github.com/crisboarna/react-cv -b name_for_new_branch`.- Make changes and test
- Submit Pull Request with comprehensive description of changes
Full license details can be found in LICENSE.md





