Fork me on GitHub

What is it?

SilkJS is a command shell built on top of Google's v8 JavaScript engine, highly optimized for server-side applications. Targeted for the Linux server environment, the API strongly resembles Linux OS and library calls.

* SilkJS runs on Linux and is supported for OSX as a development environment.

View project on GitHub SilkJS Google Group

Scripting for the Server

SilkJS enables JavaScript as a scripting language in the server environment. You can think of SilkJS as a command shell, along the lines of Perl or PHP, except the language you write in is JavaScript. Virtually anything you currently do with a combination of server-side technologies can be done using JavaScript running under SilkJS.

Blazing fast HTTP server

SilkJS includes an HTTP server written almost entirely in JavaScript. You don't have to wonder what's going on under the hood, or dive into a mess of C++ code to figure out how it works. The server is pre-fork model, so you get to write your business logic top-to-bottom and left-to-right. With SilkJS, you will find you write less code and it runs faster!

Fewer Moving Parts

SilkJS does a lot of what you want out of the box, including the dynamic loading, compilation, and execution of dynamic languages like JST, CoffeeScript, Markdown, and Less CSS. The HTTP server naturally uses your machine's resources, including your CPU cores, as your application demands.

Ideal for RIA

Rich Internet Applications (RIA) tend to be a single page with little HTML markup. The client pages are rendered as logical components via DOM manipulation in JavaScript. The content for these component areas are fetched from the server via AJAX calls. SilkJS HTTP server can deliver the HTML markup, the static content (images, stylesheets, JavaScripts, etc.), and handle large numbers of AJAX requests.

RPC Strategy

Each Ajax request from client to server can be thought of as a remote procedure call. The client JavaScript program requests a remote method, either by URL scheme or by POST or query_string parameters, and passes arguments to that remote method the same ways. The server executes the requested procedure and returns the results via HTML, JSON, XML, or other agreed upon format. SilkJS HTTP server is very fast for these types of transactions.

API Strategy

A primary design objective of SilkJS is to implement of its ecosphere as much as possible in JavaScript. To that end, the lowest level functionality is implemented as the most minimal "glue" functions to the operating system's functions and library functions. The idea is to implement sophisticated JavaScript API on top of these glue functions.

OS-Level API

SilkJS provides a thin layer of "glue" functions to access Linux and OSX OS calls:

  • File System
  • Networking
  • Process Management
  • Console

Library API

SilkJS includes a thin layer of "glue" functions to access several popular libraries:

  • GD2
  • MySQL
  • ncurses
  • SQLite3
  • SSH2
  • CURL
  • memcached

JavaScript API

SilkJS comes with a set of classes and modules that you may use (or roll your own!):

  • Showdown (Markdown)
  • CoffeeScript compiler
  • Less CSS compiler
  • UglifyJS minifier
  • PHPJS (some functions)
  • MySQL
  • Schema (ORM)
  • SSH (exec, scp, sftp)
  • XHR

Operating systems like Windows, Linux, BSD, and Solaris are written in "C" for good reason - it's the fastest structured and (mostly) portable language. JavaScript is quickly becoming the "C" language of the Internet. SilkJS brings the speed of v8 compiled JavaScript and the "C" function calls to JavaScript.

In "C":

#include <stdio.h>

int main(int ac, char *av[]) {
	printf("hello, world\n");

In SilkJS:

function main() {
  print("hello, world\n");
#include <stdio.h>
#include <unistd.h>

int main(int ac, char *av[]) {
  if (fork()) {
    printf("main process\n");
  else {
    printf("child process\n");
fork = require('builtin/process').fork;

function main() {
  if (fork()) {
    print("main process\n");
  else {
    print("child process\n");


SilkJS is intended to be free for use by anyone and for any legal purpose.

To that end, please see this link:

Pick whichever license you choose, as long as it is OSI approved.