Solfege S SolfegeJS

The modular framework for NodeJS

Introduction

SolfegeJS provides a modular mecanism to build applications. It helps to initialize and communicate with bundles that contain all the logic and resources.

The framework works with Javascript Harmony. The core is designed with generators and the workflow avoids callbacks.

Application

Application Bundle A Bundle B Bundle C

The application is the container that contain bundles. It is used to initialize, configure and run bundles.

It also provides a way of communicating between bundles via internal URIs.

Bundle

Bundle A Bundle B Bundle C Bundle D

A bundle is a structured set of files that implements a single feature.

It can be independent or it may need other bundles.

Workflow

main.js Application Bundle A Bundle C addBundle() register addBundle() register start() "start" event doSomething()

After creating instances, the application adds the bundles into his registry. Then, it initializes the bundles and dispatches a "start" event. Each bundle can listen the event and act accordingly.

Examples

Here are some use cases. They are intentionally simple in order to highlight the concepts.

A clock displayed on the terminal

This is a simple bundle that display a clock. It listen the "start" event of the application and write the time on the screen.

Source: https://github.com/neolao/solfege-example-clock

Command Line Interface to manipulate images

It is a set of commands available in the terminal. It uses the bundle solfegejs-cli that listen the "bundles_initialized" event to get available commands from the other bundles and expose them.

Source: https://github.com/neolao/solfege-example-image-manipulation

Simple website

The solfegejs-server provides a HTTP server with a middleware mecanism. The router and template engine are middlewares. Each bundle configuration can be overridden by the application.

Source: https://github.com/neolao/solfege-example-website