Chaplin maps HTML templates to API endpoints and renders them server-side.
It's great for:
- Quickly prototyping an app from an existing JSON API.
- Quickly shipping an non-user facing app, like an admin interface to your main app for your sales team.
- Writing an app only using HTML, Mustache and YAML.
Like any other Ruby gem, Chaplin can be installed with
$ gem install chaplin
Or added to an existing project's Gemfile
gem 'chaplin'
You can create a new project with
$ chaplin new my-app
Here is the basic structure of a Chaplin app:
- public/ # all files in there are served statically
- templates/ # HTML templates that will be rendered using Mustache
- app.yml # The YAML mapping between API endpoints and HTML templates
- chaplin_config.yml # The url of the API the server will connect to, and other configuration values
You can start the server either with the chaplin
command, or as a Rack application.
-
chaplin-blog is an example app with a Parse backend
-
chaplin-init is a starting point with some basic front end dev tooling (gulp, zurb foundation and such)
For troubleshooting or any questions about using Chaplin, hit me up on twitter @VictorMours.
Chaplin is still in its early days, so I wouldn't recommend it for user-facing production apps just yet. We've been using it for an internal app for a couple month and it does the job.