A fine (PfaJn) stack to put maps on the web.

While building GEOLYTIX open source web mapping framework XYZ we are continuously revising and trying to improve our stack to match our requirements. Performance, security, scalability and developer experience are the core metrics for all components in our solution stack.

Traditionally a web development stack included an operating system (such as Linux, the L in the LAMP stack) as a platform to build on.

Most modern web development stacks use Node.js as their platform. Being able to run on any OS as well as serverless, Node removes the need to specify the OS. Besides, you wouldn’t host a web server on Windows, would you? You may skip this article now if the answer is yes.

We are not quite there yet but aim to deploy XYZ serverless in the near future. Ongoing dev deployments with the excellent Zeit Now BaaS (Backend as a Service) are very promising. Please follow us @GEOLYTIX to read more about our experience with Zeit Now in a future article.

With Node being the platform of choice for many web solution stacks the other components are usually the database, the web framework (or app controller layer) and the presentation layer.

You don’t need to be…

One of the most popular software bundles is meAn.

Within the meAn stack, mongoDB acts as data store and expressJS being the web framework. These are accompanied by the popular JavaScript application framework AngularJS.

meAn is a versatile and production tested stack but it’s components maybe overkill for most applications. You will need to invest a lot of resources upfront to master the concepts and syntax of each component.

Angular is great for complex two-way data bindings. So are React, Vue, Ember, Knockout. But I am guessing that you are not building the next Facebook.

Keeping the UI in sync with the state is really hard. The main reason why modern JavaScript web frameworks exist. XYZ serves up a mostly static, single page, mapping application. Map render and interactions are handled by Leaflet, Mapbox-GL or OpenLayers.

Thus we are looking for fast server side rendering of the client application interface. This can be achieved with a simple templating engine such as EJS which was heavily used during the project’s genesis. We soon switched to the JSRender templating engine. JSRender is simple, intuitive and lightning fast. Practically perfect.

meJn stack’s evolution

It’s a web mapping stack! Data at rest will be in a PostGIS extended PostgreSQL database.

Why should you care about PostGIS?

Having a powerful database already setup and maintained, it made sense for us to drop MongoDB from the stack and migrate settings as well as access control lists (ACL) into PostgreSQL. PG, the node-postgres library allows the XYZ backend to connect to the database and manage a connection pool which will become important once we scale our production deployments.

source: logicalerrors.wordpress.com

From PeJn to PfaJn

express, the fast, unopiniotated, web framework for node was the last block to be exchanged in our spatial first stack. XYZ is very much an opinionated framework.

We believe in a certain way of approaching a business process which is inherently better and provide software created around this approach.

Fast is good but we wanted to engage ludicrous speed. Black alert: Get ready for fastify.

The LTS release of fastify in March was huge in terms of our stack’s evolution.

Fastify is the handler function that you pass to the HTTP core module, nothing more.

The majority of data transferred between our client application and the backend is JSON. GeoJSON to be specific.

Making use of fast-json-stringify, fastify outperforms its peers in benchmarks. Disclaimer; These benchmarks measure overhead and not throughput. I also respect the Eran Hammer’s opinion in regard to web framework benchmarks. We are looking forward to produce our own benchmarks which measure production data throughput later this year.

Apart from reducing application overhead and most likely throughput, the most significant improvement has been to my very own developer experience. That is while I am not procrastinating over web dev posts on Hackernoon. The fastify community may be small but support from core maintainer as well as contributors has been nothing but excellent.


Here we are now and yet the road ahead is still long and winding. I need to complete some routing strategies. There is a ton of features to be realized for the client application. There is no session store yet and we are seriously thinking to replace cookies with JWT. How do you you authenticate mate?

We have only just begun to test serverless deployments with Zeit Now. Not to mention that our webpack4 is almost zero config.

Most of all we are looking for reinforcements. We are now at a stage at which we need a dedicated DevOps engineer. The project repo wants some tlc, testing, QA and versioning.


Please get in touch with us if you are interested to join our team or for any XYZ related inquiries.


Any buy ins and comments are welcome. Please share if you like this article.