Have a look at this if you want to start with a small code base.

http://incise.org/index.cgi/TinyWM

-- Erik