Website Breakdown

09 Dec 2025 - sam

Welcome to the blog! My current vision here is to do little write-ups on whatever I’m working on, or interesting things I’ve learned recently, or anything else that seems interesting. To start things off, I wrote a little bit here about how the website actually works, at a semi-technical level (but still hopefully understandable and interesting to a layman).

The webserver that powers this website is nginx. In simple terms, a webserver is just a program running on a machine somewhere; when you try to connect to the machine, the webserver negotiates with you to set up a secure channel to communicate over, and then sends you webpages (files on the machine) through that secure channel.

The webpages are built using jekyll. Remember, webpages are just files written in a set of special languages (HTML, CSS, JavaScript, PHP) that a web-browser understands. When the server sends you the webpage file, your web browser knows how to “translate” those languages into a pretty website for you to look at. Jekyll is a tool which helps automate the creation of these webpages, since it can be very tedious to write and maintain HTML by hand.

The machine itself that facilitates all of this is a Virtual Private Server (VPS) that I rent from Digital Ocean. A VPS is basically a computer running “inside” of another computer: Digital Ocean has a physical machine (really, a big set of machines), and that machine is running lots of specialized programs that emulate smaller machines. I pay Digital Ocean a monthly fee to rent one of those virtual machines. In return, they grant me total access to the virtual machine, and provide a public address where other machines on the internet can visit to get access to my machine (for example, to reach the nginx webserver and view the website that this machine is hosting).

The address that Digital Ocean provides is not “samdowney.dev” – it’s an IP address, which is just a special number that other machines can use to locate my (virtual) machine on the internet. When you type in “samdowney.dev” (or any website) into your webbrowser, your computer reaches out to one of 13 globally hosted “Domain Name System (DNS) Root Servers”; these servers direct you to a number of other “sub” DNS servers, which contain records saying that “samdowney.dev” points to my virtual machine’s IP address. To get those records on the globally hosted DNS servers, I bought the domain name “samdowney.dev” through Cloudflare Registrar. Cloudflare gives me “ownership” of the domain, meaning I can install those records on the DNS servers saying where “samdowney.dev” should point to.

(In fact, traffic to “samdowney.dev” is proxied through Cloudflare’s servers. That means, when you connect to “samdowney.dev”, you actually connect to one of Cloudflare’s servers. Cloudflare anonymizes your information, makes sure you’re not a robot, and then forwards your request to my webserver. They basically act as a middleman for privacy, safety, and efficiency purposes.)

There is a second server running on my machine, which acts as an “Application Programming Interface” (API) to access the high-score leaderboards for some small games that I’ve made. If you connect to “api.samdowney.dev”, nginx will see that you actually want to connect to this API server, and will forward the connection on to the API server (remember, nginx and this other server are just programs which run in the background on the machine). The API Server is a program that I wrote: it uses SQLite to maintain a small database. If you send very specially-crafted requests to the server, you can interact with the database (either posting a high score, or fetching the existing high scores). The small games that I’ve created know how to construct these special requests, and also how to parse the server’s response and turn them into a pretty, human-readable leaderboard. The webpage at https://samdowney.dev/leaderboards also knows how to construct these requests and parse the responses, so that the leaderboards can viewed directly in your web browser. (TO DO!)