Introduction
I have started a major new area of core development. It is about enhancing the capabilities of TiddlyWiki under Node.js to their full potential:
- Hosting multiple wikis at once, with the “bags and recipes” mechanism for sharing data between them
- Improved handling of file uploads and attachments, allowing gigabyte video files to be uploaded and streamed
- Instantaneous synchronisation of changes between the server and all connected clients
- Workflow processing on the server, for example to automatically compress images, or to archive webpages
- Robust authentication and authorisation options
These are deep changes that require significant reengineering of existing code. To avoid breaking backwards compatibility, everything is packaged as an optional new core plugin called “multiwikiserver”. Users that do not install the plugin will not notice any changes from how TiddlyWiki works today.
I’ve started work on the hosting of multiple wikis, and am currently working on the handling of file uploads and attachments. The code can be seen over at GitHub, which is also the best place for technical discussion about the implementation.
In this thread I wanted to focus on the implications of these enhancements for users.
I am really excited about the possibilities. I personally use TiddlyWiki pretty intensively in the form of single file wikis for each of notes, recipes and guitar sheet music. My guitar wiki is around 100MB because it includes lots of images; it performs OK on my hardware but feels like it is getting closer to the limit of acceptable performance. There are several other areas of my life that I would love to get into TiddlyWiki where the obstacle is the need to handle large quantities of media in the form of images and videos. I would like to be able to drop whatever is relevant into my wikis, without having to stop and think about the performance implications.
Usage
MultiWikiServer installation and usage will be almost identical to today. The initial screen resembles TiddlyDesktop.
There is a list of wikis at the top, shown with their “favicon”, name and description. Clicking on a wiki opens it in a new browser tab. As you work on it, changes are synced as individual tiddlers to the server; you do not need to remember to save changes, and you are not slowed down while saving takes place.
The screenshot has many mysterious references to bags, which we will explore in the next section.
Bags and Recipes Model
The idea of bags and recipes is very simple. Tiddlers are stored in named “bags” which act like folders. Wikis are constructed from a list of bags called a “recipe”, putting together the constituent tiddlers to make a single wiki.
So, in my own case, not only would I have bags called “notes”, “guitar” and “recipes” that make up wikis of the same name, I might also have a bag called “customisations” that is added to each wiki so that I can have uniform customisations across all of my wikis that I can update in a single place.
The semantics of bags and recipes can be expressed more formally in a small number of propositions:
- Bags are containers that can contain zero or more tiddlers
- Bags have names
- Bags cannot contain more than one tiddler with the same title
- Recipes are lists of bags in a specified order
- Recipes have names
- Recipes cannot contain the same bag more than once
- The tiddlers within a recipe are those that result from overlaying the tiddlers from each bag in the recipe in turn. This means that where there is more than one tiddler with the same title, the one in the bag that is highest in the recipe is the one that “wins”
- Wikis are constructed from the tiddlers in a particular recipe
- Tiddlers that are modified from the wiki are always saved to the topmost bag in the recipe
The key concept is the way that bags overlay one another in a recipe. It is very similar to the way that ordinary tiddlers overlay shadow tiddlers, hiding their value. Just like shadow tiddlers, if the tiddler in a higher bag is deleted it will reveal any tiddlers with the same title in lower bags.
In the screenshot above, you can see that each wiki has an associated list of bags. The highest bag is highlighted to show that it it is the one that will receive new tiddlers.
This work is the culmination of many years of thinking and planning. The idea of bags and recipes dates back to TiddlyWeb, more than 15 years ago. It has been tried and tested through the TiddlySpace years. It is intensively used in Anna Freud’s Manuals, a collection of nearly 1,000 intertwingled wikis with over 1,000 users and a total of over 1GB of data. You can see it at https://manuals.annafreud.org/. The original version of TiddlyWiki 5 in 2012/2013 included a partial implementation of bags and recipes that is still present today, but until now it has not been fleshed out enough to make it useful.
Final Thoughts
There is quite a lot to take in here. I intend to make more posts about other aspects of the work, but in the meantime questions and comments are very welcome.