node package manager



NPM version Build Status Coverage Status

A teensy little web framework. Teensy is a web framework that doesn't use models or controllers. Although these are undeniably useful for large web applications, for small, static websites, they sometimes introduce an unnecessary amount of overhead.

Teensy runs as Koa middleware and includes koa-static for serving static files. Views are handled by nunjucks. A view may optionally have some yaml at the top (in comments), which is then made available to the template parser. This yaml may extend data from meta.yaml. This way, you can easily share data between views.

Since Teensy is Koa middleware, you need to use a version of node.js which has generator support.


Simply run npm install @rdcl/teensy.


To use Teensy, you only need a couple of things in your project directory:

  • A JavaScript file to initialize Teensy.
  • A directory containing a public dir, a views dir and a meta.yml file. This directory may be the root of your application. That's it. For example, your project could look something like this:
// index.js 
"use strict";
var teensy = require('@rdcl/teensy')(__dirname);
var app = require('koa')();
# meta.yaml 
default: &default
  pageTitle: foo
{# views/index.html #}
  <<: *default
  bodyClass: index
<!DOCTYPE html>
  <title>{{ $meta.pageTitle }}</title>
<body class="{{ $meta.bodyClass }}">
<h1>{{ $meta.pageTitle }}</h1>

Notice that index.html starts with a comment containing meta data. This meta data is recognized by the {#! and !#} tags.

Also notice that the meta data extends meta data in meta.yml, by using the <<: *default notation.

If you run node ., and then visit localhost:3000/ in your browser, you'll see your index view.

TODO: The rest of the documentation.