This article will cover the architecture of my two new websites:
Both the websites have a similar architecture, with the blogs website having some extra components.
Access from: Mobiles, tablets, laptops, and any other device with a web browser.
Amazon Route 53: DNS web service, used to resolve DNS queries.
Amazon CloudFront: A global CDN service that caches the website content and reduces website latency.
Amazon S3: It stores the website's static content. Read access is provided to the CloudFront distribution's origin access identity to avoid making the bucket public.
There are currently no dynamic components in the website architecture. The website is a purely static React Gatsby application.
Source Code: The GitHub repository contains a React application created using Gatsby. For the blogs website, the blog articles are written in MDX, which supports both markdown and JSX. The website infrastructure and deployment pipeline are defined using AWS CDK. Any push to the repository's main branch triggers the pipeline.
Install/Lint/Format/Test/Build/Synth: The following operations are done as part of this step:
Self-mutation: Update the pipeline if there are any changes in the CDK pipeline code.
Assets: Upload the CloudFormation template and any other assets to S3.
Permissions broadening: Ask for manual approval if new AWS IAM permissions are granted or security group rules are created.
Deployment: The synthesized AWS CloudFormation stack(s) are created/updated.
Gatsby is a framework for frontend web applications. A detailed explanation of how Gatsby works can be found here. Besides Gatsby's base features, here is a list of features I have added using Gatsby plugins:
robots.txt
file using gatsby-plugin-robots-txt.<head>
tag using gatsby-plugin-react-helmet.The dark mode changes the theme of the page and adds a 'filter' to all images to reduce their brightness. The above comparison might not look completely accurate in dark mode because of the filter.
1message = "Hello World!"2print(message)
AWS CDK is a software development framework used to define cloud application resources using programming languages like Python, Typescript, Java, etc. This application uses Python.
The resources defined in AWS CDK for this application can be differentiated into two different categories:
New articles can be added to my blogs website without affecting the main website in any way. Also, since I already had a home page, designing a separate blogs website first was easier.
I wanted to learn and use React for my website and then came across Gatsby which seemed like a good fit for a blogs website. The support for MDX, fast loading speeds, support for different plugins, easy tutorials for beginners, lots of starter templates, etc. were some of the reasons.
It is easy to write, test, and deploy infrastructure as code using CDK. Other options like Terraform have their merits, but the ease of quickly using high-level constructs and using CDK pipelines to create a CI/CD pipeline meant I went with CDK for this project.
I had two ideas in my head: either using a simple look with minimal styling or using a terminal theme. I found an MIT licensed codepen with an Ubuntu terminal that fits in with the terminal theme. I am not well versed with CSS so I struggled to make the design responsive, especially the background gradient but managed to get it working in the end. For mobile screens, I felt keeping the dimensions fixed and allowing the user to scroll and zoom in was better than awkwardly word wrapping and reducing the width.