I Created A Comprehensive Self-Hosted Digital Identity for $12/month

Over the last 2 months, I created a comprehensive digital identity that includes — a blog website, newsletter system, web traffic analytics, affiliate marketing, smart AI search, and a good old RSS feed.

Where using different proprietary tools for these was costing me more than $100/month, now it only costs $12/month to self-host everything in a Digital Ocean instance.

As I have built the system over the last 8 weeks, I have shared my learning in other blog posts. However, in this blog post, I will put it all together to help you understand the big picture.

If that sounds interesting to you, let’s get started.

Website Stack

Everything starts with my website: https://irtizahafiz.com.

Many different technologies went into its building — so before I list out the tech stack, I will try to categorize them.

    Frontend — NextJS, ChakraUI

    Backend — FastAPI, Postgres, Nginx

    Security — Nginx Rate Limits, Let’s Encrypt SSL Certificates

    Deployment — Nginx Reverse Proxy, Digital Ocean Droplet

Along with all the other technology you will hear about soon, my website is self-hosted inside a Digital Ocean instance.

Everything including the NextJS server, the backend API endpoints, and the Postgres database resides in the same machine.

The website is rendered server-side which gives me huge SEO benefits, and all the content is statically generated, which means it’s incredibly responsive.

Blog and YouTube Infrastructure

Like most personal websites, the bread and butter of mine is to serve as the home to all content that I publish.

More specifically, my blog posts and YouTube videos.

When it comes to my YouTube videos, I store all the metadata — title, description, URL — in a Postgres database. From my website, I link to my YouTube videos, rather than hosting them. It didn’t make sense to do that.

Unlike my videos though, I self-host all my blog posts.

In my NextJS app, all the blog posts are stored as Markdown files. I use a special format — mdx — which you can think of as a supercharged Markdown file. With this format, I can render code blocks and even put dynamic React components (such as “like” counters, date pickers, etc) inside my markdown content.

At build time, my NextJS app statically generates all my blog content locally.

I find this setup very intuitive. Writing in plain old Markdown files is very simple. Publishing is a breeze because NextJS does all the heavy lifting of turning my Markdown file into a pleasant-to-read webpage.

In the absence of some kind of Content Management System (CMS) that platforms like Squarespace or Ghost provide, this is more than adequate.

Newsletter and Mailing List Manager

When starting this self-hosting journey, I knew that the most complex part would be creating a free newsletter or mailing list manager.

Platforms like Ghost, Squarespace, and MailChimp do an incredible job at it. They take care of subscribe/unsubscribe forms, compliance notices, opt-out links, templates, campaign schedules, etc.

Creating one from scratch with a similar feature set was out of the question.

Enter Listmonk.

Listmonk is a free and open-source newsletter and mailing list manager that allows you to self-host.

I recently wrote about it here, if you are interested. In short, it gives me 90% of the features I need to host my 10,000-subscriber email newsletter system. I am hosting it in my Digital Ocean instance, hence costing me $0.

Web Analytics

Building a website is one thing, but measuring its performance and optimizing user behavior is another.

Without good analytics, it’s impossible to tell if the right content is being surfaced to the right people. The most common tool that gives you such user insight is Google Analytics.

However, because of a myriad of reasons — I wrote about here and here — I opted for a private, free, and open-source alternative instead.

Enter Umami.

Similar to Listmonk, Umami also gives me close to 90% of the features I typically need, with full privacy and at $0.

It lets me track my website’s performance, and customer interactions, as well as custom events that I use to measure conversion funnels.

All customer data is stored locally in a Postgres database, hosted on my Digital Ocean server. So, it’s both private and secure.

Smart Search

Okay, if you have stuck around so far, I have the most interesting feature to share with y’all now.

An Open AI-powered Smart Search that lets the user search across all my blogs and YouTube videos.

I did a few deep dives on this topic: ~I Built a Realtime Smart Search Pipeline~ and ~Building an AI Search Feature With OpenAI Embeddings & Postgres Vectors~ if you want to find out more about its design.

Similar to everything above, all the infrastructure powering this feature is hosted on the same Digital Ocean cluster, free of charge.

There’s one cost component though — $$$ required to use OpenAI’s Embeddings API.

Usually, it’s a few cents only. To reduce that further, I have implemented caches at every step in the pipeline. The caches are also hosted locally on my server.

Out of all the features, “Smart Search” has brought me the most joy. So, I would love for you folks to try it out at https://irtizahafiz.com.

RSS Feed

Alright, let’s wrap it up with one of the most simple, but powerful features — RSS Feed.

I am a huge fan of RSS feeds.

Rather than being at the mercy of algorithms, I like to explicitly follow content from people that I admire. Then, I add their blogs to my RSS feed.

When I have some time to read, I intentionally pull from my RSS feed, rather than consume what an algorithm feeds me.

That’s why, it was important for me to expose a RSS feed containing all my blog posts.

I used python-feedgen to construct the XML file that defines my RSS feed. It’s constructed for all my locally hosted Markdown files.

Every time I publish a new blog post, a script runs on my server that updates the RSS feed and publishes the file to https://irtizahafiz.com/feed.xml.

You can import the feed into your RSS feed reader of choice.

Closing Thoughts

If you have made it this far, I hope you found this valuable.

It’s been a lot of fun building out this comprehensive digital presence for less than $12/month.

Not only was it exciting to build the full suite of products — blog, newsletter, analytics, smart search, RSS feed — but also being able to self-host everything and use privacy-focused technologies was amazing.

Here are a few ways you can do so: follow me on Medium, subscribe to my website, or follow me on YouTube.

Irtiza Hafiz

;