nathanielknight / tiddly-wiki-server

An efficient, low-maintenance web server for TiddlyWikis.
Other
33 stars 4 forks source link
self-hosting tiddlywiki

TiddlyWiki Server

Contributor Covenant

This is an efficient, low-maintenance web server for TiddlyWiki. It uses the [web server API] provided by the TiddlyWeb plugin to save tiddlers in a SQLite database. It's written in Rust.

Running the Server

The easiest way to run tiddly-wiki-server is with Docker Compose. You can grab the compose file from this project and then start a server with

docker compose up

To run the server directly,

  1. Build or install the executable (e.g. by checking out this repository and running cargo install --path .).
  2. Run the server:
    tiddly-wiki-server --bind 0.0.0.0 --port 3032 --dbpath ./tiddlers.sqlite

If the database doesn't exit, tiddly-wiki-server will create and initialize it.

See the tiddly-wiki-server --help for instructions on changing the bound address, port, database path, etc.

Motivation

TiddlyWiki 5 has a NodeJS based web server that re-uses much of the front-end JavaScript for maximum compatibility. However, this server needs about 70 MB of memory to start, and can easily consume 100 MB or more. This is fine for running on a workstation, but a cheap VPS quickly gets crowded running services that size.

In rudimentary benchmarks it looks like tiddly-wiki-server uses about 10 MB of memory, which I find much more manageable. It's also easier to deploy!

License

This project is made available under The Prosperity Public License 3.0.0, which gives you broad permissions for:

but doesn't let you build a business on the author's work.

If you're uncertain if your use case might be infringing or you want to use it under a different license, reach out to @natknight.

Differences from TiddlyWiki

The initial page that this project serves has a few changes compared to the empty wiki you can download from http://tiddlywiki.com/empty.html. It has:

This modified wiki was created by following this procedure:

  1. Download an empty TiddlyWiki from tiddlywiki.com/empty.html
  2. Add the TiddlyWeb plugin via the plugin library
  3. Add a script element to the very end of the HTML document with
    • class="tiddlywiki-tiddler-store"
    • type="application/json

The empty wiki is then embedded in the tiddly-wiki-server binary; when the page is loaded, it inserts the stored tiddlers into the empty wiki and serves it. The result isn't exactly what you'd get by loading the content into a regular TiddlyWiki and saving it, but it has all the same features, including that you can always download a copy and have a full, working TiddlyWiki with all of your tiddlers.

Contributing

The most valuable way to contribute to this project is currently testing: try to setup a TiddlyWiki with it and see if it behaves the way you'd expect. The server aims to have feature parity with the first-party NodeJS server; any discrepancy is a potential bug, which I'd be very grateful to have reported!

Code of Conduct

Contributors are expected to abide by the Contributor Covenant.