Skip to content
This repository

V8 Based JavaScript Swiss Army Knife (and HTTP Server!)

branch: master
Octocat-spinner-32 builtin Fix httpd/main.js to not try/catch include() errors. October 15, 2013
Octocat-spinner-32 coffeescript Added coffeescript/ directory with an example testing coffeescript su… February 11, 2012
Octocat-spinner-32 examples Can now start as root and setuid/setgid to another user. May 22, 2013
Octocat-spinner-32 extras Can now start as root and setuid/setgid to another user. May 22, 2013
Octocat-spinner-32 httpd-coffee Automatically loads require.js and include.js and a few others (see March 15, 2012
Octocat-spinner-32 httpd Fix httpd/main.js to not try/catch include() errors. October 15, 2013
Octocat-spinner-32 lib Merge branch 'dev' of https://github.com/mschwartz/SilkJS into dev July 29, 2012
Octocat-spinner-32 modules fix documentation January 04, 2014
Octocat-spinner-32 osx-installer OSX Installer now assures /usr/local exists (by doing mkdir -p) May 30, 2013
Octocat-spinner-32 src Removed try/catch from v8.compileFile() altogether. October 15, 2013
Octocat-spinner-32 tests Added error message to thrown error message from MySQL connect. August 11, 2013
Octocat-spinner-32 walkthrough Added documentation comments, walkthrough dir, made coffeescript buil… March 18, 2012
Octocat-spinner-32 .gitignore OSX Installer now assures /usr/local exists (by doing mkdir -p) May 30, 2013
Octocat-spinner-32 .gitmodules Adding submodule dox March 12, 2012
Octocat-spinner-32 CMakeLists.txt Changed min version to 2.8 so it could run on windows December 30, 2011
Octocat-spinner-32 LICENSE Updated README, fixed typo in LICENSE file. January 15, 2012
Octocat-spinner-32 Makefile Merge branch 'dev' of https://github.com/mschwartz/SilkJS into dev July 29, 2012
Octocat-spinner-32 README Updated build instructions December 24, 2011
Octocat-spinner-32 README.md [TOC] doesn't work. December 30, 2013
Octocat-spinner-32 install-osx.sh Added more text during install. June 21, 2012
Octocat-spinner-32 notes.txt Notes February 16, 2012
README.md

About SilkJS

SilkJS is a console application that wraps the v8 JavaScript engine. It is designed for Ubuntu Linux, but it also compiles for OSX as well as other flavors of Linux.

SilkJS implements a thin layer of "glue" to access the various operating system functions and functions of other useful libraries.

A great deal of focus on the SilkJS project is performance. SilkJS was designed to facilitate the implementation of the included HTTP server, but has proven to be far more useful in numerous console and server-side applications. The HTTP server has remarkable performance characteristics, and the core logic is written entirely in JavaScript!

Some people say SilkJS is a synchronous version of NodeJS. It was not designed to be such, but it was designed to be a faster alternative to NodeJS for Linux-based server applications. You might think of it as the command-line version of JavaScript, akin to command-line versions of PHP or Perl. Like in those languages, you can implement alternatives to shell scripts, command-line applications, and even full blown Internet servers.

CoffeeScript

SilkJS HTTPD is a full featured CoffeeScript server. For more details, see:

https://github.com/mschwartz/SilkJS/wiki/CoffeeScript

Graphical Debugger

SilkJS supports the V8 debugger. You can use node-inspector to debug your programs.

For more details, see: https://github.com/mschwartz/SilkJS/wiki/Debugging

Features

Perhaps the greatest feature of SilkJS is that you write synchronous code; there are no callback function implementations required on your part. The theory of operation is exactly the opposite of NodeJS - that synchronous programming is more natural, and the code actually runs faster if you let the OS do its thing. There is no "nested callback hell" with SilkJS. Not only is your code more readable (top-to-bottom, left-to-right), various sample programs we've converted from NodeJS to SilkJS are quite a few lines shorter. On top of this, your synchronous code makes sense in both server and command line applications (why do you need to do async I/O in a command-line program?).

SilkJS runs CoffeeScript pages, Showdown/Markdown pages, and JSP-like JST JavaScript pages. If you have a file in your documentRoot with a .coffee extension, it is loaded, compiled, cached, and run upon request. If the file is changed on disk, it is automatically reloaded, compiled, cached, and run. The same is true for JST programs, files ending with .jst extension. Files ending with .md extension are loaded and interpreted each time using Showdown (Markdown processor). If you have a file named index.coffee, index.jst, or index.md, that file is run for URIs for that directory that end with /.

  • CommonJS require 1.1 implementation
  • XMLHttpRequest implementation for accessing WWW services
  • Basic implementation of console as you typically would call in browser code.
  • Rich set of POSIX File System methods.
  • Rich set of Process methods.
  • Implementation of glue for libgd2 for graphics manipulation.
  • Implementation of HTTP "helper" methods (see below).
  • Implementation of MySQL functions.
  • Implementation of SQLite3 functions.
  • Implementation of NCURSES functions.
  • Implementation of NETWORK functions (sockets, etc.).
  • Implementation of SSH2 functions (exec remote commands, etc.).
  • Implementation of functions to manipulate the V8 engine itself.
  • JSP-like JavaScript templates
  • Execute CoffeeScript programs server-side to generate HTML
  • Showdown/Markdown templates
  • and more!

License

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

To that end, please see this link:

http://www.opensource.org/licenses/alphabetical

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

HTTP Server

The SilkJS HTTP server is fast... REALLY fast. It's also robust enough to handle 20,000 concurrent requests (as tested with ab).

On a I7-2630QM CPU @ 2.00GHz, SilkJS HTTP outperforms lighthttpd and nodejs (v0.6.5):

REQUESTS PER SECOND

silkjs = 26759 rps
lighttpd = 17183 rps (v1.4.29)
nodejs = 2212 (v0.6.5 - single core, simple static server)

The HTTP server requires a tiny bit of code that is not in JavaScript. The reading of mulit-part MIME POST data containing binary data cannot be done in JavaScript because JavaScript does not natively support a binary data type. Otherwise, the server is written almost entirely in JavaScript. Even the CommonJS require() method is written in JavaScript.

QUICKSTART

See the instructions on installing SilkJS at http://silkjs.net

Useful Links

Home Site: http://silkjs.net/ (POWERED BY SILKJS, not Apache, not ngnix)

Google Group: http://groups.google.com/group/SilkJS

Check out the Wiki here, too: https://github.com/mschwartz/SilkJS/wiki

Something went wrong with that request. Please try again.