Building a custom blog engine
This blog has been created using Node.js, Express, Typescript, Handlebars, Markdown, Less, JSON, YAML, and a simple NoSQL database of my own design, all running on Amazon web servics using Elastic Beanstalk.
UML Class Diagram
The UML class diagram of the blog engine.
Note that the above diagram was generated by plant-uml
The application architecture follows the MVVM or Model View View-Model pattern.
While I have worked with MongoDb, express NoSQL, and DocumentDB noSQL databases in the past. For this simple blog engine I did not want to start with the overhead of setting up a database. Rather I wanted a quick NoSQL database for developing and testing concepts only. To that end I developed a simple NoSQL database engine that relies on the local file system.
Collections are backed by file system directories. Documents in the database are backed by one or more files. A file can contain multiple properties as a JSON or YAML file or a file can contain a single property, like a text, html, or markdown file holding a large string property. The file system is watched so changes in the file system are immediately available to the blog engine through the NoSQL interface. This allows for on-the-fly changes to data during debugging. One of the more interesting features of this database is that it supports references between colletions.
I will be publishing the source code for this NoSQL database in the near future.
An example of the file structure is as follows:
Picking an IDE was an interesting challenge. Having talked to several other devs about their IDE of choice for NodeJS development, I settled on ATOM as the most popular. I forced myself to use ATOM for several days just to make sure I wasn't being baised and to try new things, unfortunately I couldn't shake my use of Visual Studio. The fully integerated debugging and comprehensive typeahead features that make the visual studio environment so much more productive just were not available ( I tried several pluggins ). I switched back to Visual Studio and for NodeJS development this really is my IDE of choice. I should also not here that I made the same choice for cross mobile phone development using Apache Cordova, the Visual Studio team just got it right and I was impressed there too.
One thing that did trip me up through was that the Lynux file system is case sensitive and even through you can set an option in typescript to help enforce case sensitivitly for module paths, case sensitivitly is not really that well enforced. I had to remember to be carefull about naming. Things would always work well debugging locally, but when I deployed to Elastic Beanstalk, the service would show as degraded, and after looking at the logs the problem almost always was file not found because of a case sensitivitly problem.
Features of this simple blog engine are as follow:
- Dynamic RSS Feed
- Articles are dynamically filtered by tag
- Projects are dynamically filtered by skill
as I indicated earlier... a simple blog engine