Skip to content

This describes and deploys all the infrastructure used in AWS to power the backend of my personal portfolio website.

Notifications You must be signed in to change notification settings

aasmal97/Arky-Personal-Website-AWS-CDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The purpose of this web application is to showcase the projects that Arky has created throughout his software development journey.

This is the entire backend, deployed on AWS. The client side is deployed here

If you are looking for the client side code go here

Notable Structure

This app is structured into 3 categories, with important functions associated with each

  1. Hosting contains the functions required to deploy cloudfront distributions, all domains, and s3 buckets.
  2. Rest API contains the function to deploy the monolithic Rest API on API Gateway, as well as every lambda function connected to it.
  3. Webhooks contains the functions that deploy a DynamoDB Table that is used to store webhook data, so a cron job can run and refresh them after expiration. This also contains the logic that deploys a seperate API on API Gateway that handles callback events from a github and google drive webhook event.

Dependencies

This app uses a series of dependencies and you can check the list in the following package.json file. Most notably are the following:

  1. AWS CDK Lib which is used to deploy all AWS infastructure, as code.
  2. Google Apis for creating webhooks on a personal google drive, that push changes to database when changes are made
  3. Jimp for programmatically editing images
  4. HTML to Text for parsing through HTML, and allowing personal site to display information available to the public UI, but not available on it's public API
  5. Email validator for validating email structures, and date-fns for validating dates
  6. Azure's Computer Vision AI API that is used to generate a caption to an uploaded image.

Build + Deploy

Build

This project uses Typescript for type safety, however, AWS lambda functions cannot be written as such. Therefore, custom build steps are needed to compile typescript to javascript.

This is automated by calling custom build scripts, included in the top-level directories (hosting, rest api and webhooks). These scripts use built-in node libraries, like execShellCommand and fs for initiating build actions, and copying resulting files into the build folder. This works suprisingly well, and no issues have been observed so far. However, there is always a chance that files will take to long to copy, and cause a build failure.

  1. To build this project, to check for type saftey, run npm build
  2. To build this project and migrate compiled files into a build folder and generate a cloudformation template, run npm bootstrap

Deployment

This project is auto deployed through a custom github action, that creates cloudformation templates and then auto deploys them to AWS.

To initate the deploy process on your local machine you must:

  1. Request access to an account on AWS, that has AWS Lambda, Route 53, API gateway, Cloudfront and/or DynamoDB access. You will only be able to change infastructure that your account has access to.
  2. Run npm serve

Releases

No releases published

Packages

No packages published