Setting up TiddlyWiki PWA on windows with a Simple Batch Script

TiddlyPWA turns TiddlyWiki in a PWA with offline-first functionality, near realtime synchronization, and client-side encryption. Follow this tutorial for a quick and easy setup for local use or testing before fully committing to setting up a server.

1. Install Deno:

Deno is the software that run the TiddlyWiki PWA server. To install it, right click on the windows start button, choose terminal (Admin), then type the following command and press Enter:

winget install DenoLand.Deno

If winget does not work, you can manually download and install deno here: https://deno.land/

2. Generate your Admin Password Hash and Salt:

3. Create a launcher:

  • Create a new folder on your computer that will contains your wikis files.
  • Inside that folder, create a text file with this content:
@echo off
setlocal

:: Set the admin password hash and salt (replace with your actual values)
set ADMIN_PASSWORD_HASH=YOUR_GENERATED_HASH
set ADMIN_PASSWORD_SALT=YOUR_GENERATED_SALT

:: Set the path to the SQLite database file
set DB_PATH=%~dp0pwa.db

:: Run the Deno server with appropriate permissions
deno run --unstable-broadcast-channel --allow-env ^
    --allow-read=%~dp0 --allow-write="%DB_PATH%" ^
    --allow-net=:8000 ^
    https://codeberg.org/valpackett/tiddlypwa/raw/branch/release/server/run.ts

endlocal
pause

:warning:Replace YOUR_GENERATED_HASH and YOUR_GENERATED_SALT with the hash and salt values you generated in step 1, then save the file and rename it from New Text Document.txt to run_tiddlypwa.bat. Make sure the extension is .bat.

Now you can launch the server simply by double-clicking on run_tiddlypwa.bat. You will be able to access it by navigating to http://localhost:8000 in the web browser of your choice (on the pc running the server).

4. Automatically running the server

  • Press Win + R to open the Run dialog box.
  • Type shell:startup and press Enter. This will open the Startup folder.
  • Copy or create a shortcut of your .bat file into this folder. Any files or shortcuts placed in this folder will automatically execute when you start your computer.

If you dont want to see a shell open on startup, you can create a VBScript launcher. Create a text file in the Startup folder, with this content:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "C:\Users\user\tiddlypwa\run_serve.bat", 0, False 'Replace with your .bat file path
Set objShell = Nothing

Save the file with a .vbs extension (e.g., run_hidden.vbs).

Note: This setup is for local use only. If you want to access your TiddlyWiki PWA from other devices, you’ll need to configure port forwarding or use a service like Cloudflare Tunnel (as mentioned in the original forum post).

3 Likes