Demo App

This is the demo app for Sinja, provided both as an example of and for testing Sinja. It uses Sequel ORM with an in-memory SQLite database and demonstrates the Sequel extension for Sinja. It works under both MRI/YARV 2.3+ and JRuby 9.1+. It is a very simplistic blog-like application with database tables, models, serializers, and controllers for authors, posts, comments, and tags.


Assuming you have a working, Bundler-enabled Ruby environment, simply clone this repo, cd into the demo-app subdirectory, and run the following commands:

$ bundle install
$ bundle exec ruby app.rb [-p <PORT>]

The web server will report the port it’s listening on (most likely 4567), or you can specify a port with the -p option.

Alternatively, if you don’t want to clone this repo and set up a Ruby environment just for a quick demo, it’s available on Docker Cloud as mwpastore/sinja-demo-app:

$ docker run -it -p 4567:4567 --rm mwpastore/sinja-demo-app

It will respond to {json:api}-compliant requests (don’t forget to set an Accept header) to /authors, /posts, /comments, and /tags, although not every endpoint is implemented. Log in by setting the X-Email header on the request to the email address of a registered user; the email address for the default admin user is This is clearly extremely insecure and should not be used as-is in production. Caveat emptor.

You can point it at a different database by setting DATABASE_URL in the environment before executing app.rb. See the relevant Sequel documentation for more information. It (rather naïvely) migrates the database and creates the default admin user at startup.


You can certainly use this as a starting point for a production application, but you will at least want to:

And probably a whole lot more!