Skip to content
Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
JavaScript Other
Pull request Compare This branch is 373 commits behind master.
Failed to load latest commit information.
examples Merge branch 'ejs' of git://
site @ 61b9c6b Passing render() a function is actually an alias to then()
test Fixed partial() tests to reflect the new API
vendor qunit-spec not dependent on jQuery
.gitignore Changes to the way logging works
.gitmodules Removing jqunit spec Push Sammy 0.5.4
LICENSE Added MIT License. Also first draft of README Updated HISTORY, pushing 0.5.3
Rakefile sp typo: lastest => latest
package.json Push Sammy 0.5.4



Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby's Sinatra.


Download sammy.js and install it in your public javascripts directory. Include it in your document AFTER jquery.


Like Sinatra, a Sammy application revolves around 'routes'. Routes in Sammy are a little different, though. Not only can you define 'get' and 'post' routes, but you can also bind routes to custom events triggered by your application.

You set up a Sammy Application by passing a Function to the $.sammy (which is a shortcut for the Sammy.Application constructor).

$.sammy(function() {

  this.get('#/', function() {


Inside the 'app' function() this is the Application. This is where you can configure the application and add routes.

Above, we defined a get() route. When the browser is pointed to #/ the function passed to that route will be run. Inside the route function, this is a Sammy.EventContext. EventContext has a bunch of special methods and properties including a params hash, the ability to redirect, render partials, and more.

Once you've defined an application the only thing left to do is run it. The best-practice behavior is to encapulate run() in a document.ready block:

var app = $.sammy(...)

$(function() {;

This will guarantee that the DOM is loaded before we try to apply functionality to it.


Sammy requires jQuery >= 1.4.1 Get it from:



Keep informed!


Sammy.js was created and is maintained by Aaron Quint with additional features and fixes contributed by these talented individuals:

  • Frank Prößdorf / endor
  • Alexander Lang / langalex
  • Scott McMillin / scottymac
  • ZhangJinzhu / jinzhu
  • Jesse Hallett / hallettj
  • Jonathan Vaught / gravelpup
  • Jason Davies / jasondavies
  • Russell Jones / CodeOfficer
  • Geoff Longman
  • Jens Bissinger / dpree
  • Tim Caswell / creationix
  • Mark Needham
  • SamDeLaGarza
  • Mickael Bailly / dready92
  • Rich Manalang / manalang
  • Brian Mitchell / binary42


Sammy is covered by the MIT License. See LICENSE for more information.

Sammy includes code originally created by John Resig (Class implementation) and Greg Borenstien (srender).

Something went wrong with that request. Please try again.