
Last Friday was a quiet day at work, so I had time to work on the website. I spent half of the day implementing this new messaging feature, but now I am glad how it turned out. I had to setup a database and an API service – there has been so much time I haven’t done those before that I almost forgot how laborious that is. I got inspiration from the Dark Souls series, where players can see messages left behind by other players in the same spot. Let’s see how people will use it!
You may be thinking I had to put some bucks into it to get it working but actually it’s (almost) free. Here’s how it works:
Components:
I used Python + FastAPI to create the API service and it is running on CR – which by itself has a monthly free tier of memory, compute and requests. Actually, even if I exceed the free tier, it is very cheap. Since not a lot of people are visiting my website, I am getting by with 128mb + < 1 CPU.
MongoDB also has a free tier with some limitations: 512mb storage + weekly 10GB data transfer. However, that is not going to be a problem for my 2 weekly visitors, LOL.
Also, I had to set up some guardrails to protect the service from exploitation. We cannot trust anyone on the internet! Here’s how it is set up:
If you are interested in having a look into the source code, it is all available on github.
I think this kind of post is heavily technical, so I may add devlog, personal, etc sections to the journal soon.