gitwtfhub

wtf is director?

flatiron/director — explained in plain English

Analysis updated 2026-06-26

5,576JavaScriptAudience · developerComplexity · 2/5Setup · easy

TL;DR

Director is a tiny JavaScript routing library with no dependencies that works in both the browser and Node.js. Define URL-to-function mappings in a table and Director calls the right function automatically when the URL changes.

Mindmap

mindmap
  root((repo))
    What it does
      URL routing
      Function dispatch
    Environments
      Browser hash routing
      Node.js HTTP
      CLI arguments
    Features
      No dependencies
      Async handlers
      Named parameters
      Wildcard patterns
    Use cases
      Single page apps
      Node servers
      CLI tools

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Add client-side hash-based routing to a single-page app without jQuery or a full framework

REASON 2

Handle HTTP request routing in a Node.js server using the same API as your front-end router

REASON 3

Route command-line arguments in a Node.js CLI tool using the same library as the web app

REASON 4

Build URL-driven browser apps where content changes without full page reloads

What's in the stack?

JavaScriptNode.js

How it stacks up

flatiron/directorcrocodilestick/calibre-web-automated501351981/vue-office
Stars5,5765,5805,582
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasymoderateeasy
Complexity2/53/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min
License terms are not mentioned in the explanation.

Wtf does this do

Director is a small JavaScript library that handles URL routing. Routing is the part of a web application that decides which code runs when someone visits a particular address or clicks a particular link. Instead of writing that logic yourself, you define a table that maps URL patterns to functions, and Director calls the right function automatically. What makes Director unusual is that the same library works in two different environments: inside a browser and inside a Node.js server. Most routing tools are built for one or the other. Director supports both with the same API, which simplifies projects where you want consistent behavior on the front end and back end. It has no dependencies, so you do not need jQuery, Express, or any other framework to use it. In the browser, Director watches the part of the URL that comes after a hash symbol, such as the fragment in an address like example.com/#/books. When that fragment changes, usually because the user clicked a link, Director runs the function you associated with that route. This pattern is common in single-page applications, where the page never fully reloads but the content changes based on the URL. On a server running Node.js, Director routes incoming HTTP requests by URL and method, such as GET or POST, to the appropriate handler functions. It also supports a third mode for command-line tools, where routes are matched against arguments passed to a script rather than a URL. The library supports features like parameterized routes (where part of the URL is captured as a variable), wildcard patterns, asynchronous route handlers, and nested route tables. The README includes extensive code examples for each feature. Director is a fairly mature project from the Flatiron organization and appears to have been widely used, though the codebase has not seen recent activity.

Yoink these prompts

Prompt 1
Using Director.js, set up client-side routing for a single-page app with routes for /, /about, and /users/:id
Prompt 2
Show me how to use Director to route GET and POST HTTP requests in a Node.js server without Express
Prompt 3
How do I set up a wildcard route in Director that catches any URL not matched by my other routes?
Prompt 4
Write a Director router for a Node.js CLI tool that maps command-line arguments to different handler functions
Prompt 5
How do I use asynchronous route handlers in Director and signal completion so the next handler can run?

Frequently asked questions

wtf is director?

Director is a tiny JavaScript routing library with no dependencies that works in both the browser and Node.js. Define URL-to-function mappings in a table and Director calls the right function automatically when the URL changes.

What language is director written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

What license does director use?

License terms are not mentioned in the explanation.

How hard is director to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is director for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.