About two years ago, I discovered Go on cat-v.org, a website containing (among others) various interesting essays on programming and design. I was familiar with (two of) its principal architects, Rob Pike and Ken Thompson from their work on Unix and Plan 9, and a programming language with a C-like syntax, mindset and a modern design interested me.
Go proceeded to be a revelation. From the simple-yet-familiar syntax, the minimal design, the rich standard library, the tool-kit, the documentation and the active community support, it contained everything I wished a programming language would. Seriously, it rocks.
I pondered on possible projects to which I could apply my new-found Go-fu. I settled at creating a web framework, which was originally aimed at replacing the aging PHP-based framework at a company I previously worked for. Alas, the framework was never quite adopted, but continued development meant that the code had time to mature into something usable.
I recently released the framework, and an accompanying CMS, as free software under the names Sleepy and Cecil, respectively. What follows is a short overview of each.
Sleepy is a web framework in two parts, client and server. The server is written in Go, and runs as a daemon, listening for and responding to JSON-RPC requests over a TCP socket. The “canonical” client implementation for Sleepy is written in PHP, and consists of a thin layer of wrapper code around methods exposed by the server, along with some client-only parts (routing, inflection etc.). Web applications are then written in PHP utilizing the functionality implemented by the client.
Sleepy isn’t meant to be ground-breaking. My intention was to build a robust, easy-to-use and lightweight (in terms of code) framework that would follow established conventions and would allow the creation of complex systems whilst staying out of the way, as much as possible. The client design follows conventions used by the CakePHP and CodeIgniter frameworks, especially the Router, Model-View-Controller and Database modules. On the other hand, Sleepy attempts to be much simpler than both these frameworks, whilst providing comparable functionality.
Most of all, Sleepy is meant to allow for creating web applications with the least amount of coding possible. It does this by providing out of the box functionality for Controllers and Models that help cover most common use cases, as well as a robust routing system.
A more detailed look into Sleepy’s conventions and internals will follow shortly, along with a short tutorial on making a simple web-page with Sleepy. For now, you can find the code for each individual part of Sleepy in the following repositories:
Cecil is the de facto content management system for Sleepy, built on Sleepy. It aims to be modular and feature-rich whilst keeping a lightweight code-base and design.
Cecil is generic, and is suitable for web pages and applications of all kinds. It does not attempt to make any assumptions about the environment in which it will be used, and follows conventions used by the client framework, while not enforcing its own in any way.
Applications (or Clients, as they are referred to in Cecil) each use their own database and administration modules, and can function seperately from each other or from Cecil. Databases are structured to be usable and maintainable outside of Cecil, and do not contain any boilerplate specific to it.
Development on Cecil is ongoing, and there is still a lot to work on. However, it is usable as of now, with most major functional components having been extensively worked on and used.
You can check out the code for Cecil on the GitHub repository, or browse around a demo installation of Cecil in the following links. The credentials for the demo user are demo and demo123 for the username and password, respectively. Also, a couple of screenshots of Cecil’s client and module administration interface (disabled in the demo).
I will continue developing Sleepy and Cecil, as it is already being used in various projects, including this website. Once I am satisfied with the stability and feature-set of both projects, I will release version 1.0.
I am also interested in looking into and possibly designing a web framework entirely implemented in Go, with minimal requirement for coded logic, based on data sources, filters and flows. If such an idea is practically feasible, it might end up being released as Sleepy 2.0.
Thanks for reading.