Offline Wiki

This is an idea for a program I’ve been tossing around for a while, and at this point I haven’t been able to find anything like it. Basically the idea boils down to an ‘offline wiki’ – a Wiki you can use locally, but that will also synchronize on the internet, letting you use it anywhere.

I really discovered the power of Wikis about a year ago when I first started to use Trac (which is an excellent source code / project management tool that I can’t recommend enough). I found the Wiki component very useful for creating documentation on the APIs and protocols I was developing, as well as a notepad for designing overall concepts (which naturally evolves into documentation for the progarm) and collecting research notes. It’s a very fast way to keep a growing collection of documents, keeping them fairly organized in the process.

At the same time, I find I use notepad on my laptop a lot to save quick notes or describe ideas. Much of the time I don’t have internet access – like when I’m sitting in an airport, on a ferry, waiting for someone on a job site, etc – so all these notes just end up on my desktop (or eventually deleted or in folders when I get around to sorting them). Most of the stuff would be gerat to have in a Wiki, but the most important part is being able to edit them while I’m offline.

Really, the simple solution is to install a webserver an a wiki locally on my computer. I’m a fan of simple solutions, but at the same time, this does mean that without my laptop I don’t have any notes. What would be the best case is to have a Wiki I can edit on my computer, or go online and edit from any internet connection. It should synchronize any changes in both directions whenever my laptop is connected.

I think this is actually quite feasable. The wiki would need to edit flat files (not use a database). Rsync could then be used to synchronize changes back and forth, and just be set to run periodically. The entire thing (a webserver, php, wiki software, rsync) could be bundled into one installation file (and though the install code would be different, it could easily be cross-platform for both Windows and Linux. Hell, even OSX could get in on the action).

The most difficult problem would be handling conflict resolution, when there’s two conflicting changes that rsync can’t handle on its own.

I’m wondering if it would be better to actually use a database (it would be nice to avoid running a database server on the laptop though). A “last synchronization” time could be stored, and then the synchronize script would just have to look at entries created/modified since that date. This would mean the synchronization code would have to be written from scratch, but that also means it could be written as an actual web page in the application, that prompts the user on how to handle conflicts as it comes across them. It could communicate to the server using REST.

There should be something in the page header (on the site running locally) that tries to connect to the server, and if it can, and there are any new entries (on either side) since the last synchronization time, then display a “Changes have been made. Click here to synchronize to the server” button. If it can’t connect, then it can just display a “You are working offline” button. Changes locally while online could even be posted to the server using REST, so no synchronization is necessary. It might even be possible just to do synchronization in the background silently, only notifying the user if there’s a conflict to handle..

Now my random thoughts are turning into a decently complicated application. That’s really why I’m posting this on my blog: I have enough to do already, someone else take this idea and write it ;) Do it GPL or similar, and I’ll probably even help out a bit.