06/12/2024 18:00
With an interview fast approaching and the prospect of having to talk about a project I've created looming; it's best that I actually create something and am able to talk about the design process.
So despite this site being able to one of those projects, something with more flair would be helpful and by flair I mean, it does more than just serve HTML back.
So the following will be the documented process of how I went about creating TODOWEB.
What I hope to create:
I'm thinking, that having a web application that allows for users to login and create updates to their own personal todo lists would be a good place to start. Extensions from this should come later (such as giving them an API to pull data from). Therefore, the following functionality needs to exist:
From here I'm making the following assumptions/list of tasks:
This really doesn't seem to bad.
My best bet is the just start building at least one of these things (it'll be the database as that's going to be the most annoying) and then come back and update this page as the updates to the project progress.
However, the tech stack I intend to use for this (and how I've already set up the project) will be writing the backend in Zig (using Zap) as a framework, SQLITE as the database engine and then HTMX as the front-end.
Hopefully, this will be BLAZINGLY FAST
06/12/2024 18:37
I need to be on the most up to date version of Zig (master) in order to make use of all of these fancy libraries, I'll just try compiling from source and see how long that takes on this machine. Surely, nothing will go wrong!
06/12/2024 18:45
I LOVE ZIG SO MUCH!!!!!! Being able to just download the binary and have everything work is HOW IT SHOULD BE. This also means that I can go back and use the other version of the library, no compiling LLVM for me! At least this time...
06/12/2024 18:55
They work! Both Zap and the zig-sqlite libraries load and their demo versions are functional! This now means that I can start on trying to get some kind of base plate down! I say that, but I must refer back to what exactly I want to accomplish otherwise I'll lose sight. Right now, I think designing the DB to handle user logins is going to be my best bet. However, once this is done, a lot of the other parts should fall into place as if I can register, login and show user data on a page; then having linked data to a user should be a breeze!
This is really begining to sound and look like rambling, but I know that I'd end up loving reading something like this, reminds me of The Martian (2015) with the video logs, lame example and thing to reference but that's where I've gone!
12/12/2024 22:36
I had worked on this last night but had forgotten to write an update, whilst everything appears to be working (zig build run works), it seems that I need to do a lot more reading on how Zig really works.
(This also reminds me that I need to add code blocks into this site, but for now just making references to things will do)
With the way that `sqlite.Db` works, what I ideally want to do is wrap it within my own struct that I can then call a `.get()` method on for the zap user authentication. The Lookup for the Authenticator will need to mimic a hashmap, (which is what it uses in the example code). So in theory, it should just be a case of having that `.get()` method return a []const u8.
But it is with this wrapping that I am encountering issues, probably best that I read up, not on the syntax that would make it work but HOW Zig wants me to think about it.
I'd encountered something similar when doing a technical test in React, the syntax was just Javascript so that wasn't the issue, but the ideas and philosophy of HOW these things work together (I've never used States before) was the missing link!
<Sources: