A sign that appears to be at a climate rally that reads “there is no planet B”
A sign that appears to be at a climate rally that reads “there is no planet B”
Photo by Li-An Lim on Unsplash

We’ve been hearing about the energy cost of mining cryptocurrencies such as Bitcoin for years now. With the recent surge in the value of such coins (the USD value of one BTC is hovering around $59,000 at the time of writing but was at around $6,000 a year ago), the concerns of how much energy is consumed by the distributed computation network used to power such blockchains have once again entered public discourse.

The Crisis

So, what exactly is happening? Well, according to my search engine results, Bitcoin mining alone (so, disregarding all other cryptocurrencies for now) has an annual carbon footprint…


This will cover getting our backend API up and running!

If you missed part 1 and need to set up some your initial docker-compose file and directory structure, you can check that out here if you want.

It was either this or a generic photo to act as a metaphor for the word “fast”

FastAPI

Let’s start with FastAPI. FastAPI is a python framework that makes it super easy to stand up a REST API. But we can take a brief moment to evaluate it as a tool.

Pros:

  • OpenAPI compliant (which means free Swagger documentation!)
  • Support for typing (for IDE hints)
  • Fast (per their documentation, as performant as NodeJS- and Go-based backends)

Cons:

  • No native frontend built…


This will hopefully help you take out most of the guesswork of standing up a fully containerized, multi-page web application with a backing database.

What you know/aren’t scared by:

  • Docker, Docker Compose
  • Python (3.6+ because f-strings are *chef’s kiss*)
  • JavaScript (at least a little, but this is an article about infra, not aesthetics)

What you will have by the end of this:

  • A dynamic, multi-page frontend to display books
  • A simple database to hold said books
  • A clean REST API to shuttle information between the two
  • All of the above, but also in containers

Good to go? Let’s get started…


I recently came across an issue where I had to stand up a scalable compute pipeline and make it easy to deploy for others to stand up themselves.

For a myriad of reasons (I won’t give you the story of the long road filled with tech hardships or any of that), I went with Terraform for my declarative infrastructure, AWS Batch for my compute, and AWS EFS as my storage. However, it was pretty annoying to get everything together because there’s not a ton of documentation on how to make it all work. So… eggs.

You know how I’m filled with rage? I have no outlet for it so… eggs.

I’m going to describe how…

Joseph Min

Software Engineer @ HMS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store