Creating this personal site

Author: Juraj Zvolenský
Date: 2025-04-01

Table of Contents

Introduction

If you made it all the way here, you are probably interested in how this site was created. Well, you are in for a treat! The levels of completely unnecessary complexity are off the charts! This whole website is something you could have created in 2 hours with a simple static site generator, but no, I had to build a whole go server with dynamic content generation. To be fair, I wanted to utilize my Raspberry Pi 5 for something. I have also made a status page for it, so you can see if it is up and running. Check it out here.

Server Setup

Sure, I could have used static HTML to write all this text. However, as the time goes on I wanted to be able to showcase my work and projects online. For this purpose, I needed an actual server, which is able to host a variety of application, services, and deliver dynamic content.

Server Setup

Raspberry Pi 5

The Raspberry Pi 5 is a small, low-power computer that is perfect for hosting a personal website. It is energy-efficient and can run 247 without consuming too much power. The Pi is running the DietPi distribution, as I want to keep the power consumption quite low. The Pi is sitting next to me at home and is connected to my home network. This opens the door to a lot of security issues. Therefore, I am running Nginx as a reverse proxy to handle incoming requests and route them to the appropriate service. Additionally, there is a Cloudflare Tunnel set up to provide a secure connection to the server. This way, I can access my website from anywhere without exposing my home network to the internet. Both Nginx and Cloudflare are setup as services, so that in case of a power failure, they will automatically start up again. This setup allows me to rebuild and redeploy the server with a single bash script.

go-server

I could not figure out a better name for a multipurpose server written in Go so here we are… The idea behind it is to provide a basic modular web server, which can host a variety of applications and services I will build over time. go-server currently supports:

It utilizes Gin, which is a web framework for Go. It is lightweight and fairly easy to use as this is my first time developing something proper in Go.

Markdown is handled by gomarkdown, which is a very neat package for converting Markdown to HTML. Together with Chroma, we can also have syntax highlighting for code snippets!

The project is set up so that it is very easy to add a new module. Each module is a separate go package, which acts as a handler for a particular application. Once a handler is implemented, all that is required is to register the route in the router.

The simple static content such as the homepage /, /rpi, and /sideprojects are served directly from the handlers package. The /sideprojects/:article_name route is a bit more complex, as it serves the content of the article. The article is written in Markdown and is converted to HTML. The HTML content is then rendered using a template so that all articles keep the same shape, form, and style. It is a lot of added complexity, however, what it allows me to do now is simply write an article like this one in Markdown, and it will be automatically converted to HTML and served on the website. I can also easily add new articles without having to modify the server code. The server will automatically pick up the new articles and serve them.

I suppose that is all I am able to say about the server for now. I have not actually implemented anything fun yet, just the basic framwork to get me going. In the future I would like to try and implement a few modules. I am going to experiment with other languages and see if I can make them run on the server.

References