Skip to content
NodeJS/Express application which generates PDF certificates from handlebars template using flyingsaucer. Uses SASS, Gulp, Handlerbars and Docker.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

MOT Test Certificates

NodeJS/Express application which generates a PDF certificate from handlebars template using flyingsaucer.


This application is hosted on heroku (cedar-14 stack) using the address below.

**It is password protected, please contact repo owner to retreive details from the Heroku account under settings **

Local Setup

  1. You will need latest versio node/npm and JDK
  2. Clone this repository and cd into it using terminal
  3. Install all npm dependencies
npm install


NPM is used to import certain packages required for this project. You can find the depenceny list inside of the package.json file.


Start Development

This script is used to to start gulp watch task and run express server with nodemon. The NODE_ENV is automatically set to development, which is used inside of certain gulp tasks.

npm run start-dev

This will start a local server located at the address below:


Build Production

This task is used to process all ES6 express server code and build all assets ready for publishing. The javascript is processed using babel and the babel env preset to make the output compatible with nodejs. It has been tested with nodejs version 8.9.0. This is mainly required because nodejs does not allow ES6 imports/exports and many other features like the spread operator.

To build assets it runs the gulp build task which is documented further down on this page.

npm run build-production


This is java application which generates a PDF from HTML using iText.

This application uses two jar files from the compiled version of flyingsuacer and itext. These are located in the flyingsaucer folder.

Flyingsaucer Guide


This is the templating language used. The data is taken from JSON files found inside of the data directory.

Handlebars Official Website


GulpJS is used to process the assets files (images and scss).

It is also used to move files into the dist folder once building for production use.

You can find the source code of all gulpjs tasks inside of the gulp folder.

Gulp Tasks


This will run all of the tasks in series to build all assets. This is used to build production assets for dist folder before publishing. You are required to also set the NODE_ENV to production.

gulp build


This task is used to move all font files into the dist folder.

gulp fonts


This task is used to move all image assets into the distribution folder. If NODE_ENV is set to production then it will also compress images with imagemin.

gulp images


This task is used to pre-process the scss files into normal css files.

You can import npm packages into the scss files by using the package name, instead of the full node_modules path.

The task will use autoprefixer to automatically add any prefixes required for CSS 2.1 which is used by flyingsaucer.

When NODE_ENV is set to production it will also minify all css using cssnano.

When NODE_ENV is set to development it will also include sourcemaps inside of the css file.

gulp scss


This task is used to move all view templates into the distribution folder. This is only used as part of the build task before publishing.

gulp views

Compile Handlebars

This task will compile all of the handlebars templates into html with inline stylesheets. This is used as part of the build production to allow for easier development.

gulp compile-handlebars


This task is used to run scss, images and fonts tasks and watch for any changes to the scss or image assets. When a change is made it will automatically re-run that particular task.

gulp watch

Docker setup for development

You will need the latest version of docker installed

Running development mode

For faster development you can use docker by running the following command:

docker-compose up

After which the server is located at the local address below:


Building production

Run the following command

docker-compose run --rm app npm run build-production
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.