I’ve been writing webapps for a long time, and over that time I’ve written them in as may ways as possible. Currently my default is to create a simple server-side-rendered webapp in whatever language I use the most. Right now that is Go (or golang) so I’ve created a basic web application skeleton to make it easier to get something rolling without trying to figure out (or remember) how to link all the bits together. Instead of relying on third-party http routing and rendering frameworks this web application attempts to stick to packages provided by the golang sdk itself. Third-party packages are used to provide low-level security middleware and session storage/caching backends.

Features:

  • Cookie-based, server memory-based, or memcached-based HTTP sessions.
  • Static assets served directly from the webapp.
  • Server-side-rendered HTML templates, with buffered template rendering to prevent output of incomplete or malformed content in the event of template evaluation errors.
  • Two build modes:
    • dev - serves static assets and templates directly from the local filesystem. Allows for development of templates and static assets without needing to restart the application.
    • prod - embeds templates and static assets into the application binary to allow ease of distribution. Changes to templates or static assets require a new application build.

Check it out on GitHub and let me know there if you find it useful.

Q. Why is this called a skeleton?
A. It is a reference to a Walking Skeleton, which is a tiny implementation of a system that performs a small end-to-end function.