How I built this site

Frontend, Backend, Data storage, Infrastructure

Anshil Bhansali, Jun 22, 2020

Before I get to the how, lets go through the why. I wanted to build this site as a place to store my opinions, thoughts, knowledge and stories. I easily could have just built a wordpress or wix site in no time, but as a software engineer, I felt the need to built the entire website from ground up, and manage everything myself, and its cheaper! I wanted to build my own version of Wordpress.

My end goal was to build a system, where, in order to upload an article, all I need to do is write it in a file, acquire a few images, and simply run a python script that would upload the article along with the images in my data storage, and the article will instantly appear on the site. I'm proud to say I have done it.

The tech stack of this website is quite straight forward; starting from the frontend I have used HTML5, CSS, Javascript and jQuery. I avoided React/Vue as I am not a frontend expert and have a lot more learning to do. My expertise is in building backend systems.

I have used Python/Flask as the application server given my 3+ years of experience with Python. Flask is a great light weight framework that gives me a lot of flexibility. For data storage, I initally only chose AWS S3 since I thought I was primarily storing text content. But, after some research & development, I realized S3 is better suited for a small number of large files, versus a large number of small files. I had the latter case. So, I ended up choosing DynamoDb because it is serverless, has a user friendly API, scalable, and gives me good experience designing a noSQL database. (I am getting bored of relational databases!)

Moving to the infrastructure, I have hosted this in AWS. I have containerized this application with Docker. Flask itself is suitable as a development server, so in order to productionize it and make it able to handle traffic, I have set a uWSGI server connected to it, and an nginx server as a reverse-proxy in front of the uwsgi server . Now the application can handle traffic, and its containerized with Docker. All thats needed is to host it.

Since I chose containerization over virtualization, I thought it would be a good experience for me to deploy it with ECS + Fargate . This would give me a clean, scalable deployment solution. This deployment option is a serverless compute option, so all I need to provide is containers, set up appropriate configurations, and I dont need to manage any virtual machines.

With this experience, I have learned a lot, right from development all the way to deployment, and also writing good content! Hope this makes sense and you enjoy my other content :).