Want to Learn a New Language? Write a Blog Backend!

A 9 minute read.

Most of the content on my blog requires a fair bit of technical context to understand. This post is aimed at beginners as well as people with a lot more experience in the industry. It also covers a question that I get asked a lot:

Mara is hmm
<Mara> What is a good project to use for learning a new programming language? It seems like a really open ended question and it can be hard to see where I would end up with such a thing.

Here is a project that you can use as an end goal for learning to program in a new language: I call it Within's Minimal Viable Blog. With this project you will build a blog engine that can also function as a portfolio site.

Mara is happy
<Mara> A portfolio site is a personal website where you can show off what you've done and helps you stand out from the crowd. The blog you are reading right now is a perfect example of a portfolio site. These kinds of sites are also important in a "keeping the internet weird" sense. You can do a lot more flair and customization to a website you own than you can to a Twitter profile or similiar.

It's also designed to make you dip your toes into a lot of commonly used technologies and computer science fundamentals in the process. Namely it makes you deal with these buzzwords:

Cadey is enby
<Cadey> You can rip out a lot of this and still end up with a viable result, such as by making a static site generator. However if you have never done something like this before I'd be willing to argue that it's well worth your time to attempt to do something like this at least once.

At a high level, here's what you should end up with:

Mara is hacker
<Mara> All these admin views and forms are needed because they are what allow you to modify content on the blog. When you upload code to GitHub or use the web editor, this is the kind of thing that GitHub has implemented on the backend. You can also likely reuse the "new post" form as the "edit post" form because they do very similar things.

For extra credit, you can do the following extra things:

If you've never done a project like this, this may take you a bit longer. You will have to do some research on the best way to write things in your language of choice. A good starting language for this is something like Python with Flask or Go with the standard library, namely with net/http and html/template. This may take you a week or two. If you've done this kind of thing before, it may take a few days to a week depending on how much experimentation you are doing.

Numa is delet
<Numa> What the heck is a "URL slug"?

Mara is hacker
<Mara> Most of the time a "URL slug" means some URL-safe set of characters that help humans identify what the content is about. If you look at the URL for this article, you can see that its slug is new-language-blog-backend, which is purely for humans to read. You can either take this as something you generate by hand on each post, or take the title, remove non-space and non-alphanumeric characters, lowercase it and then replace spaces with dashes. This would turn "Hello World!" into "hello-world" or similiar.

Here are a few steps that may help you get started doing this:

There are no wrong ways to do this. You can take shortcuts where you want. You can use Markdown for formatting posts. You can do anything you want based on this skeleton and it will be your creation. Nobody else will have something exactly like this. It will let you stand out as a professional and can help you create your own home on the internet.

Numa is happy
<Numa> Something else to keep in mind here is that this first attempt will be ugly as sin. It will be hacky as all hell. However the important part here is that it works above all else. You can come back and make it better later. The first pass is always the most ugly, do not let this discourage you. This is a personal form of expression. Don't be afraid to let your personality show through your website. That's what helps to make you stand out in a sea of LinkedIn and Twitter profiles.

Mara is happy
<Mara> Yeah, getting started in something you've never really done before can be hard because you won't really have a good idea of what's "correct". The only "correct" thing in this project is that you can connect with a browser and see the things you expect. Take chances, make mistakes, get messy!

If you do go through with this and want to show it off to people in a followup post, email your results to [email protected] with the following information:

The road to expertise is paved with the effort of experimentation. I hope that this open-ended project can help you learn things.

This article was posted on M03 02 2022. Facts and circumstances may have changed since publication. Please contact me before jumping to conclusions if something seems wrong or unclear.

Tags: beginner backend

This post was WebMentioned at the following URLs:

The art for Mara was drawn by Selicre.

The art for Cadey was drawn by ArtZora Studios.