Skip to content

Latest commit

 

History

History
147 lines (102 loc) · 4.4 KB

HACKING.md

File metadata and controls

147 lines (102 loc) · 4.4 KB

Hacking the Application

Before proceeding any further, read the following documents:

  1. contributing source code
  2. code of conduct
  3. software license

introduction:

While Node.js applications are mostly platform-agnostic, we assume you're developing using a Unix system. Should some development script, tool, etc. not run in your windows (etc.) machine and you know how to make it compatible, consider sending a pull request.

Table of Contents

application architecture:

The directory structure of the code repository:

.
|-- config/     # configurations
|-- data/       # data files, particularly for the different networks
|-- engine/     # business logic (the "heavy-lifting")
|-- routes/     # routing logic
|-- schema/     # JSON Schema files for our data-file specification
|-- test/       # our tests
|-- web/        # web interface (whatever you see in the browser)
`-- app.js      # main entry point, with bootstrap code

The application is built using, mainly:

starting the application:

Usually, before starting the application, you'll need to build some files:

$ npm run build

The application can be started in either development or production mode:

$ npm start            # start in production mode
$ npm run start-dev    # start in development mode

data entry:

Data entry is a one-off task, that is crucial to this application, so as to ensure the data used does not end up being stale and inaccurate. This is one of the most simple yet cumbersome development task. No extensive programming knowledge is required.

To get started:

bundling for the browser:

We are not re-implementing the cost calculation module (engine/math.js) and other necessary modules to support calculations on browser (client-side). Instead, we bundle the modules, using browserify, producing web/js/engine.js. This script allows us to re-use the same code, on server and browser.

However, there are some significant variations. In particular, we:

  • require the data-file to be available on the browser; this is injected by nunjucks.
  • do not have access to the elaborate error classes; all errors are basically just instances of Error

deployment:

Feel free to contact the developer, should you want to submit sensitive information concerning the hosting server, etc. Also, CC the information to we@forfuture.co.ke, with a suitable subject line.

news:

You can find major news concerning the application at http://mmtc.forfuture.co.ke/news/.

Since we are avoiding restarting the application, just to reflect any recently-added news, the developer in-charge of deployment handles this process:

  • a new branch, from the develop branch is created with a name in a format, similar to news/2016-04-23.
  • new news are added to the beginning of web/_raw/news.md
  • while the new branch is reviewed and merged back, the updated news.md should be uploaded to the server, using SSH or similar tool.

News are now updated!

HAPPY HACKING!