node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Navatar, the Node.js Avatar Generator

Generate visually-pleasing, unique avatars using Node.js

Check out the demo!

Key Features

  • Easily add randomly generated avatars to your existing Express application using the built-in middleware
  • Generate fast SVG images that look good at any size


  • For production performance, it is recommended that you cache generated images as PNGs using your exisitng file server
  • No support for PNG files yet (you can optionally read the SVG from the route and convert into a PNG using svg2png - this process works but is slow)

How it works

Navatar uses built-in algorithms to create cellular automata, a la Stephen Wolfram's "A New Kind of Science", which heavily influenced this project. When the MiddleWare is invoked, an SVG is randomly generated based on the key provided, and sent to the user.


  • First, install via NPM
npm install --save navatar
  • Then, add as express MiddleWare...
const { getNavatarMiddleware } = require('navatar');
const express = require(`express`);
const app = new express();

Now, your /avatar route will serve up SVGs!


Custom width and height

Pass width and height as query paramaters to modify the size of the generated glyph. (It is recommended to use the same value for width and height.)


Coming Soon!

  • Support for additional tree-generation algorithms
  • Better color palette support
  • PNG support (one day!)