I made a website for myself (as a backend developer)
So, after some time of procrastination and a failed attempt to do it I have actually made a website. Not that it's fancy or something for me to be proud of it but I just really dislike doing frontend. I mean, I could have asked my friend to design it for me but it feels wrong to let another dude determine what my personal place in the world wide web would look like. Besides that, it helped me to play with some things that I would not need a feel to touch otherwise.
In this blogpost I would like to write a little bit about the way I decided to organise stuff this time, about some architectural decisions that would totally bite me in the arse later and the newly found love for Casio.
The stack
Going into this project I wanted to explore golang's template feature. The last time I've heard it of it was really early in my gopher arc and it is not really talked about in the circles I usually visit (aka reddit). It is probably caused by the small trend called javascript frameworks but I'm not really interested in those, especially after the incident. Another factor was the sort of comfort I feel making the client-side render. It's so easy to just throw in some REST API and plug the static file server to make frontend that it honestly feels stupid to pass on it. However, it would be a waste of a project not to learn anything new, so I opened a golang docs and went into the battle.
The actual thing turned out to be so easy it took me half a day of work instead of a couple that I planned to spend. The whole API<->JS communication went down to a dozen lines of code:
That is obviously so much easier than dealing with JSON serializers. Obvously it limits the usecases but I would argue that it doesn't have any more of those. It would not stop scrapers and who the hell would need an API for my terribly written articles.
Stylistic struggles
I am by no means an artistic person. I wanted to learn how to drow after PewDiePie's series but that week of the worst art imaginable was the furthest I ever went. That actually might have been the end of this whole operation but then STM32 related research (maybe I would write about that later?) led me to this site. It might not be the prettiest thing ever but it truly captivated me with its simplicity. With the limited range of colours and shapes it displays so much information so neatly. You can probably see the similarities in design and I am open about taking an inspiration from ciesie.com. If you are reading this, you are doing a great job and thanks for making your great blog. However it would be mean of me to steal everything from this man so I seeked another inspiration.
A little over a week ago one marketplace advertised me a chineese ripoff (or as they call it a replica) of Casio watches. The idea of a watch isn't really doing the thing for me but the timeless design of Casios made me spent $3 on this wonder. That same design came to my mind when I started to write CSS and after a quick google search I took 6 colours from this site (3 of which are gray).
Another thing about CSS is the way I used it to create a theme toggle. Normally I would just replace some properties with JS and call it a day but with challenge of using a few JS code as I can that became problematic. The solution I found is in the C letter of CSS. By overriding some properties for a .light class you can create a thing effortlessly. For example this is how I handle the colour of the text:
While you can see this in action by yourself I have to warn you that this might be the worst CSS known to manking. Inspect this site's resources with caution.
Updating contents
As I claimed before, I used Golang's template feature in this project. That means I could store articles in any form imaginable as long as I do enough preprocessing. FYI, I chose the worst way of them all and just write plain HTML that is fed to template later. But that approach falls short when you want to make things spicier with tags and stuff (Tags sorting is coming soon™). To handle this I decided to add SQLite to the project. Obviously that means we don't have any data redundancy but that problem is resolved by sroring metadata with the rest of the files in git submodule. Ideally it will be synced on all my devices and in case of a server faliure I am guaranteed to have the latest version somewhere.
The actual repo with the code + articles is located on my machine - I decided to ditch github earlier this year and one of the tasks that this site has is to be a showcase for the stuff I do. One day I will figure out public git interface but sadly that day is yet to come. On the brighter side I won't litter github activity chart with all my typo fixes and this text will go in the LLM training data a little bit later.
Plans
While functional, this project is far from completion. For one, I don't collect data on any of the visitors but I would like to see the chart of activity. Alongside that, here is the list of features I want to have:
- Tag search
- Online editor and metadata updater
- The way to do more complex file delivery - not just shove them in /static folder but do it cleverer
- Syntaxis highlight - although that introduces JS libraries I am not too fond of. Maybe figure out a golang solution? Who knows
- Feedback field - maybe not a full-blown comments system but a small telegram loopback
- 7tv emotes support - wild idea but it would be funny
Regardless of whether those goals will come to life I'm exited to see what the future holds. Until then, Physick out