Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript CSS HTML Other
branch: master
Failed to load latest commit information.
bin Ensure master branch is used in
css Css optimization for images.
en Added symlinks for swedish locale static assets.
fi Added symlinks for swedish locale static assets.
id Quick symlink fix for "/id/*" request's static assets.
img Make the beta banner smaller (70%).
js Use responsive js gallery for lib details images.
locale Sv translation updates.
node_modules Varnish works now. Remove all debug code.
sv Added symlinks for swedish locale static assets.
tests Add more tests
upstart-scripts Update upstart-script for elastic version bump.
views Open fallback gallery images in new window/tab.
.buildignore Grunt build now works, just run 'h5bp' and then view result via server.
.gitignore Compress all needed js files, inverted nav bar
.jshintrc Jshint server.js, fixed main issues: indentation, missing columns, br…
Makefile Add more tests Update
apple-touch-icon-114x114-precomposed.png New icons replace default HTML5 boilerplate icons.
apple-touch-icon-72x72-precomposed.png New icons replace default HTML5 boilerplate icons.
config.json-template Introduced conf setting default_lang
favicon.ico New icons replace default HTML5 boilerplate icons.
grunt.js Use responsive js gallery for lib details images.
humans.txt Initialized H5BP with this projects variables, made first build and d…
package.json Fix express-form version
proxy.js Compress proxy response data if browser accepts compressed data.
robots.txt Initial usage of Node.js build script and h5bp
screenshot-mobile.png Restructured readme, added About section.
screenshot-tablet-detailspage.png Restructured readme, added About section.
screenshot.png Restructured readme, added About section.
server.js Use responsive js gallery for lib details images. Small bugfixes after feedback from client. Added node environment varible dev in readme and startup scripts. Added usability testing tasks, so that usability tests can be reteste…


The Library Directory (published at is a website by Seravo Oy on comission from / City of Helsinki. It provides an easy to use interface for the public to search libraries and their details, like open times, contact information, list of services etc. It also provides widgets that web developers can embed, for example if somebody wants to display local library information on the city or muncipality website.

The site is available in Finnish, Swedish and English. A gettext-based translation systems makes it easy to add more languages.

The source, comments and other project documentation is in English. The code is designed for reuse in other countries and is not limited just to Finland.

Ohloh profile:


Screenshot of main page Screenshot

Screenshot of main page with narrow screen (mobile). Showcases responsive design. Screenshot

Screenshot of details page with medium screen (tablet). Screenshot


Project built on HTM5boilerplate for Node.js (http// and HTM5boilerplate for Twitter Bootstrap Responsive.

Other libraries are:

Icons by Glyphicons (, license CC-BY-3.0.

The Dark theme for OpenLayers by MapBox (from, license GPL2+ (as modules in Drupal-git are derivates of Drupal).

Thank you also for all the great Node.js packages we use in this project!



Instructions for Ubuntu 12.04, where the required dependencies can be installed with:

Node.js, Node Package Manager, h5bp and Java dependencies

$ sudo apt-get install nodejs npm node-less libjpeg-progs optipng default-jre-headless
$ cd Library-Directory
# make sure modules in path, otherwise require('connect') will fail
$ export NODE_PATH="/usr/local/lib/node_modules/" # example on Ubuntu 12.04

# Installing Node modules based on dependencies in package.json does not work,
# some Node.js cannot find libs or bins when dependencies installed like this:
$ # sudo npm install -g -d

# Instead install globally manually:
$ sudo npm install -g connect locale express express-form nodemailer hogan grunt nodewatch
# Normal "npm install -g gettext" no possible, library broken with TypeError: Object #<Object> has no method 'dcnpgettext'
# Install a fixed fork
$ sudo npm install -g git://

# Form the feedback form to work, you need to have some [Nodemailer]( compatible SMTP server credentials in config.json
$ cp config.json-template config.json
$ nano config.json # e.g. add the credentials of a dummy GMail account

Elastic Search (Java server)

$ wget
$ tar xvf elasticsearch-0.18.7.tar.gz
$ ln -s elasticsearch-0.18.7 elasticsearch
# Download and extract library database file to data/
# To force binding to localhost, you might want to set
# in config/elasticsearch.yml

Read-only proxy (

# Useable out of the box.
# In server/proxy.json defined to use port 8888 
# sudo required for port 80
# expects back-end Elastic Search server at localhost:9200

Generating CSS from LESS

Compile .less into .css

$ cd css
$ lessc style.less > style.css

Starting development server

  1. Start Elastic Search backend

    $ elasticsearch/bin/elasticsearch -f
  2. Start proxy for ES

    $ node proxy.js
  3. Start HTTP server

    $ NODE_ENV=dev node server.js

Finally open localhost:8080 to use server.

Running production server

Execute each step in dedicated terminal or screen.

  1. Start Elastic Search backend

    $ elasticsearch/bin/elasticsearch -f
  2. Build project, will output static files in folder output

    $ h5bp
  3. Start proxy for ES

    $ node proxy.js
  4. Start HTTP server with production variable

    $ NODE_ENV=prod node server.js

Finally open localhost:8080 to use server.

Running a production server permanently

Following steps assume you already have a working version at Library-Directory.

  1. Add use libdir to system to avoid running server directly as root:

    $ sudo adduser \
        --system \
        --shell /bin/bash \
        --gecos 'User for running library directory server' \
        --group \
        --disabled-password \
        --home /home/libdir \
  2. Move files to system location and make sure they are up to date

    $ sudo mkdir /var/www
    $ sudo mv Library-Directory /var/www/libdir
    $ sudo chown -R libdir:libdir /var/www/libdir
  3. Install Upstart scripts

    $ sudo cd /var/www/libdir/
    $ sudo cp upstart-scripts/* /etc/init/
  4. Start servers

    $ sudo start libdir-server
    # elasticsearch and elasticsearch-proxy will be started automatically

Server will now be running in port 80 and logging to /var/log/upstart/<service name>.log. Additionally Elastic Search has its own log under its own folder in logs.

There is also a script that will automatically check out the latest version, modify sources to use port 80 and server name and build the project. Make your own copy of it for your own production installation. Invoke it as sudo -u libdir ./

Note! If you want to run the server in port 80, you need to grant special permissions, since ports below 1024 are normally reserved only for the root user: $ sudo apt-get install libcap2-bin $ sudo setcap 'cap_net_bind_service=+ep' /usr/bin/node

Possibly also: $ sudo chmod +s /usb/bin/node

If Elastic Search complains about too few file descriptors, try $ ulimit -n 5000


Elastic Serach is used as the database and search backend. More documentation about the database and administration UI will be written soon..

Something went wrong with that request. Please try again.