Nine Parsecs from Milwaukee
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


0.5.1 • Public • Published


Full configurable node web server for single page applications.
Intended for platforms like Heroku or similar.

It support lot out of the box:

  • CORS
  • 404 page not found
  • helmet
  • compression
  • logging
  • clustering
  • merge app configuration with environment settings
  • dynamic frontend configuration


Supergirl can be installed and used local

npm install supergirl --save

as well global

npm install supergirl -g


Supergirl expect by default a configuration file 'supergirl.config.json' inside your project root folder. You can set a custom configuration path and file using --config argument.

supergirl --config ./config/serve.config.json

The minimum required configuration is

  • name The app name is used for 404 template
  • path Is the URL route path
  • root Is the relative root of your application
    "name": "supergirl",
    "static": {
        "path": "/",
        "root": "./dist"


Bunyan is used for logging. More option will soon be added.

    "bunyan": {
        "name": "supergirl",
        "level": "info"


Using the default koa 2 cors middleware kcors, we can pass all options throw.

    "cors": {
        //kcors options

404 - Page not found or redirect

Settings to what will happen in the case when a route is not found. By default, a 404 page is displayed. This leads on Single Page Apps using HTML 5 use style URLs to 404 page, when user press a browser reload. To avoid this, a redirect to app root is the better behaviour.

To active a redirect just add the relative path to your application. In most cases this will be root "/". Use the template property when you customize your 404 page and change the path or/and name of the template.

    "pagenotfound": {
        "redirect": false,
        "template": "404.html"

Activate redirect

    "pagenotfound": {
        "redirect": "/"

404 Page Template The 404 page template is using the EJS HTML Template. You can your own 404 page. Set the custom template folder and the template path and name inside this folder. You can attach all supergirl configuration properties inside this template.

    "templates": {
        "customPath": "./templates",
    "pagenotfound": {
        "template": "404templates/custom404.html"

Using on heroku

To enable supergirl with your app on heroku you need to install it and create a configuration file, described below.
You also need a Procfile for heroku describe how to start your app. Procfile

web: node --optimize_for_size --max_old_space_size=460 --gc_interval=100 node_modules/supergirl/lib/index.js

The options you use here depend on the requirements of your app. More information on Profile you will find on heroku.

Dynamic Frontend Configuration

Supergirl gives the possiblity to use dynamic configuration settings for your application. Simply add some settings to app section inside your supergirl.config.json configuration file.

    "backendURI": ""

You receive your app settings with AJAX call on route /config

    "backendURI": ""

Well this is still not dynamic. But you now can override these settings with environment variables.

Simply set sg_app_backendURI="" on your system and these will override the settings of supergirl.config.json configuration file.

The request /config return:

    "backendURI": ""

This way you even can add new settings to requested configuration. Just set sg_app_emailkey="123456".

The request /config return:

    "backendURI": "",
    "emailkey": "123456"


  • Add unit tests
  • Finish documentation
  • Add https server for standalone serving, as docker


npm i supergirl

Downloadsweekly downloads









last publish


  • avatar