Showing posts with label JAMstack. Show all posts
Showing posts with label JAMstack. Show all posts

Tuesday, April 25, 2023

Architecture of www.JoymonOnline.in C4 after Jamstack upgrade

Below are the previous posts about the architecture of my personal site https://joymononline.in with the date published


This is one more post with the latest architecture of the same after the Jamstack (Previously styled JAMStack) upgrade.

Introduction

Let us talk about some boring stuff. 
Documenting software architecture is always painful. Most of the time when we validate the available architecture against code, we can see it is going in 2 different directions. Basically, there is no easy way to map architecture elements to code. If we strictly follow the methodologies, it will reduce the application releases. So normally when people weigh documentation against the working code, they always prefer working code and documentation catch up later.

Is there any way we can document the architecture in sync with the code base? One of the answers is the C4 architecture model. Personally, I have been following it for around 6 years. It seems really better.

What is the C4 Architecture model?

It is advised to read the book "Software Architecture for Developers" to understand it well. In essence, it follows a zoom-in/out model to document the architecture.
  • System context - This shows how the system is going to interact with external systems over which we can't have any control.
  • Container diagram - Here we zoom in to our system. It shows what are processes required in our system or how our system is divided in terms of operating system processes. 
  • Component diagram - This shows how a process is made up. In the .Net world, this can show what assemblies are consumed by a process.
  • Class diagram - This opens up the component and shows what are the classes and how they are related.

The above only tells about the diagrams. What about the complete document. There is a sample architecture doc available in the book.

www.Joymononline.in container diagram

Now coming to the subject of this post. Below goes the container diagram of the website. Note that it includes some details of CI/CD pipelines as the Jamstack requires the static site to serve to have all the data that needs to be fetched and merged at the time of compilation.

Also, note that this is not the latest and greatest diagram as I have to get out from Heroku for hosting the YouTube proxy API as they discontinued the true free option.

What happened to component and class diagrams?

A simple personal site that is generated as a static site doesn't need complex components or class diagrams hence omitted. But for enterprise LOB applications it is a MUST have.

Tuesday, January 12, 2021

5 Mins Hugo 04 - Getting Started


This is the 4th part of the "5 Mins Hugo" tutorial series I am doing on YouTube. 

Tuesday, November 17, 2020

JAMstack JoymonOnline.in using Hugo - Part 03 - Current and proposed architecture & CI/CD system

The third part of the Hugo tutorial is also a theory. Here I am explaining the current architecture of my site https://joymononline.in and how it will look like in the proposed JAMstack based site using Hugo. Below is the video.

The main points discussed are

  • Current and proposed arch of JoymonOnline
  • The problem with dynamic content in JAMstack.
  • How to bring dynamic content into the site during compile-time and build the static site
  • How to detect dynamic content changes and recompile the static site.
  • How CI/CD work at the end using Zapier and GitHub Actions
The major shift in JAMstack is the technique of building a static website from changing contents and recompiling the site to include those future changes in the content.

Tuesday, October 13, 2020

Awesome true freemium serverless clouds

What is the need for serverside code execution?

Nowadays JAMstack is getting popular. We can do almost all the application features in the browser application itself. JAMstack is a buzzword to represent browser applications that don't require a server to work. The application can be served from a CDN that stores application code in the form of static files. 

But there are many scenarios where we need to have some sort of interaction with a central location to access data or receive push notifications etc.

Serverless functions / FaaS

In such scenarios, Serverless functions can help us. Serverless functions or FaaS(Functions as a Service) is a cloud model where we can just host a function code without getting worried about servers and related configuration. Mostly pay per usage than a fixed monthly bill.

Freemium serverless functions

If we work for an enterprise or commercial application, we don't mainly care about free tiers. But if we are doing our personal projects we may research for any free service.

Fortunately, there are a lot of free options to run server-side code. Major cloud providers have free tiers but the problem is that we need to give them a credit card. The problem with the credit card is that we may get charged, in case of an attack such as DDoS is targeted to our function endpoint.

True freemium services

Firebase was my default choice as a true freemium serverless function provider. But recently they changed their model. They now require a credit card to avail of the freemium tier. 

This change caused the below GitHub project

https://github.com/joymon/awesome-freemium-serverless-clouds

The above link tries to aggregate all the true freemium service providers. Currently, it has only 3.

Have a look at the list and feel free to issue pull requests if there are other awesome freemium cloud providers.

Thursday, August 20, 2020

JAMstack JoymonOnline.in using Hugo - Part 01 Introduction

Introduction

Following the post about "Static Site Generator a.k.a JAMstack for JoymonOnline.in..", started portion the AngularJS based site to 3 different leading JAMstack technologies. First I planned Gatsby. But after going in-depth, it feels to me like a regular React web application than a template-based static site generator. So decided to port to the second technology in the list which is Hugo. 

After starting Hugo by overcoming the big learning curve, I became a fan of Hugo. Especially it is fast processing. That leads me to a series of tutorials on Hugo about my web personal site conversion. It will not be a Hugo tutorial that covers all the aspects of Hugo, instead, the aim is to help people overcome the learning curve and focus is on its web site building capabilities than blogging or documentation building capabilities.

Organization

Most of the tutorials about Hugo are an hour long. The minimum I found is 20 mins. Everywhere including this post is talking about the big learning curve of Hugo. The hour-long tutorials second that opinion and people may think its not something for them to work on. If the size of the tutorial is 5 min, it may be more approachable to the masses through the learning curve is not changing.

So I am experimenting with 5 Mins Hugo. It is not the hard rule, I am expecting 5-8 mins for each video. Without further due below is the first video tutorial in the series.

Part 01 - Introducing the series
Part 02 - This is introduction to Hugo features, pros and cons

Friday, July 31, 2020

Static Site Generator aka JAMstack for JoymonOnline.in personal portfolio web site

No. Not really it is going to be JAM Stack as per my view. JAM Stack has a Static Site Generator but when Static Site Generator alone is not JAM Stack application. In JAM Stack application there will be JavaScript running at the browser to interact with data provided by APIs.

JavaScript+APIs+Static Site Generator = JAM Stack Application

But it is not the view of the JAMStack.org. It defines JAM Stack as follows
Fast and secure sites and apps delivered by pre-rendering files and serving them directly from a CDN, removing the requirement to manage or run web servers.
They don't need to use APIs to be called JAMStack site. Below are the quotes from the web site.
Pre-rendered sites can be enhanced with JavaScript and the growing capabilities of browsers and services available via APIs.

You may have already seen or worked on a Jamstack site! They do not have to include all attributes of JavaScript, APIs, and Markup. They might be built using sites built by hand, or with Jekyll, Hugo, Nuxt, Next, Gatsby, or another static site generator...
The main point is the site is pre-rendered and kept as static files and deliver through CDN. That being said, my view is not important. The industry recognize any static site as JAM Stack application regardless they use client-side JavaScript initiated APIs to interact with data or external services.

Welcome to my experiments with JAM Stack.

One of my previous posts was about "Why I am still with Blogger than going behind static site generators" (hereafter SSGs). There I mentioned why the SSGs are not good for blogs from my perspective. Still in the same opinion but when I considered my personal web site https://joymononline.in I feel that can be a candidate for SSGs aka JAMStack.

The current state of JoymonOnline.in site

Though it started as ASP.Net application, said bye to server-side code execution in 2017 itself. Now it is an AngularJS application served from GitHub pages. Some APIs are invoked from browser-side JavaScript to get list of projects from GitHub and recent blog posts from Blogger.

Problems

Keeping updatable contents

The home page has a section called What's new. When I added this area, my idea was to make it live as possible as twitter. But it is difficult to update frequently. I tried storing the content in Evernote, and later tried to keep in GitHub itself and dealt with its API limits. Later I decided to keep it with the HTML itself thinking I will modify it and the CI/CD will push automatically when I get full code coverage. But still, it was difficult keeping it up to date.

Client-side API calls

As I mentioned above, we may hit with API limits as every consumer has to call the API from their browser. The GitHub API throttle by the client IP address if there is no API key. The people from a company often access the internet from a single outbound IP address. It gets throttled very quickly.

Sometimes they may not have access to certain API endpoints. For example, some companies may block access to Blogger and GitHub to make sure their employees are not publishing the company code and proprietary code/algorithms. Don't laugh it happened. They access my web site but not able to see some contents.

Testing efforts

When we code any application using any technology such an AngularJS in this case, we need to test our code. Though it is not a banking application, I will feel I need to test my personal web site before publishing. As everybody agrees, it is difficult and not practical to manually test. So started automated tests. Researched different frameworks for unit and integration tests. 
Things were good until the million-dollar question triggered in my mind. Am I getting 100% code coverage? The integration tests often fail due to timing, when I just rerun it works!! May be my poor scripting skills. Overall its trouble maintaining our own code.

Technology upgrade

There are many things such as upgrading technology. Now AngularJS is getting out of support and converting to Angular is like writing from scratch.

The JAM Stack JoymonOnline.in

I don't think all the problems will be solved if I use JAM Stack for https://joymononline.in. But its an experiment to see how it takes to convert an AngularJS application to JAM Stack. I never used SSGs extensively for any of my projects. Of course, the GitHub documentation uses SSG internally. The DotNet.Helpers library uses DocFx to generate its API reference and documentation. It is SSG. But still not aware of the capabilities of JAM Stack technologies. So it would be learning to me as well on JAM Stack

Plan

The plan is very simple to convert my site joymononline.in into 3 leading SSGs. Below are the SSGs I am planning
Below are the things considered
  • No look and feel changes.
  • All existing pages and adding one more page to show my YouTube videos.
  • If possible no API calls from the client-side. Everything to be generated at the server. Includes GitHub projects, recent blog posts, etc...

References