cheatsheets devlog projects search

agenda-webdav.md

An Agenda using WebDAV

2023-01-28 1

Now I have all the pieces to do file uploads without a backend. I can set up an nginx server that will have the webdav module and with that we can upload files directly to folders.

The idea is that by doing that, I can then query those uploaded files and generate an agenda out of it. It’s a system that works only because there is full trust between the user and the server. The server is basically a dumping ground for data in any format. It’s up to the frontend system to actually take that data and make it work.

My agenda is quite simple, it retrieves a file from the webdav folder called agenda.json. This is a json file of headings and notes. I have stuff for work and for personal projects. The notes are an array of items that I need to keep in mind. I can edit, delete and create new entries and this will be saved back in the webdav folder.

91f19e952060b8ac2a062d632074ee5f

The biggest issue is that I write out the entire agenda.json file for any and all changes. This means that if the frontend makes a mistake and destroys agenda.json, then the entire agenda will be clobbered. I’ve run into this during development and so it was key to make backups periodically of a good agenda I could restore to.

So far I’ve ironed out the kinks and I really like this system. The frontend code is 200 lines of code, 100 in javascript, 50 in html and 50 in css. I want to cut this down further. I also used petitevue and I’m really liking that as my go to javascript language. It is basically my new jquery.

This application is really a proof of concept of this system of using the webdav protocol so that I don’t have to write a backend or a database. I’m curious of how scalable this system is. I imagine it probably is really scalable as it relies on nginx only. There is nothing else but nginx as the client browser is what transforms a raw text file into an application.

This also places a large responsibility on the client applications, if my frontend script actively harms the agenda.json file, there is no backend to stop it. This is quite a different style of application than I’m used to writing.

Something unrelated to the webdav is the structure of my agenda. Currently I have a heading and notes associated with it. The other way to do this would be to write out notes and have a type associated with them. Then my agenda application will find the like stuff and combine them into a section. This would give me a more freedom and control on a specific note. I could keep track of the status of things, the date it was created and various other things that would be helpful. However this would add some complexity that I may not need. I currently use a notepad to keep track of things so this is already better. It might be a good idea to use my simple version and then if I really need to keep track of extra information, add that in later. I think knowing when I complete something and being able to look back on it might be good but that may just be self indulgent. Really my goal should be to keep my agenda empty or at least small. I’m not sure yet which way I will take my agenda.