Sinatra to the Moon
Put on your headphones and let Frank Sinatra take you on a journey with the timeless classic Fly Me to the Moon. Inspired by the legendary singer, the Ruby gem Sinatra has long been the go-to choice for lightweight web applications. Now it has a companion: Sinatra To The Moon.
Built on top of Sinatra, Sinatra To The Moon is an opinionated scaffold generator that embraces the philosophy that not every project needs the weight of Rails. Sometimes, all you need is a focused starting point that lets you build quickly, experiment freely, and, as the song says, play among the stars.
This gem generates concise, modular, and testable Sinatra web applications, REST APIs, and GraphQL APIs through the flyme command. It is not a runtime framework: generated applications use ordinary Sinatra and remain independent of sinatra_to_the_moon after generation.
Successor to Sinatra Scaffold
This project is the new version of sinatra-scaffold. It continues the original scaffold generator under a new gem name and adds the flyme CLI, modular project profiles, generated-project testing, GraphQL support, and a default MVC-style web application with Tailwind CSS.
Existing users should install sinatra_to_the_moon for future updates. The original sinatra-scaffold gem remains available for projects that depend on the 0.1.x releases.
Installation
gem install sinatra_to_the_moonGenerate an application
Create an MVC-style Sinatra web app with ERB views and Tailwind CSS:
flyme new moon_appThe web profile is the default. It uses the latest tailwindcss-ruby release, so no Node.js toolchain is required. Start its CSS watcher with:
cd moon_app
bundle exec rake assets:watchCreate a minimal API-shaped scaffold without views:
flyme new moon_service --minimalCreate a REST API:
flyme new moon_api --apiCreate a GraphQL API:
flyme new moon_graph --graphqlThe explicit profile form is also available:
flyme new moon_api --profile apiPreview files without writing them:
flyme new moon_app --dry-runflyme refuses to write into an existing destination unless --force is passed.
After generation:
cd moon_app
bundle install
bundle exec rackupRun the generated application checks with:
bundle exec rakeDesign
Generated projects use modules for stateless behavior. Classes are reserved for objects that retain state and framework contracts such as Sinatra::Base and GraphQL::Schema.
Profiles remain small:
-
webis the default and provides MVC-style modules, ERB views, and Tailwind CSS. -
minimalprovides a modular Sinatra app and health endpoint. -
apiadds JSON request/response helpers and example REST routes. -
graphqladds a GraphQL schema and endpoint.
Every generated project includes request specs and RuboCop configuration.
The generator follows the same approach: Thor owns the stateful CLI class, while project validation, template rendering, and generation are organized as stateless modules. why-classes checks this convention during development.
Development
Install dependencies and run every check:
bundle install
bundle exec rakeThe default task runs RSpec, RuboCop, and why-classes.
Build the gem locally with:
gem build sinatra_to_the_moon.gemspecGenerator specs create every profile in a temporary directory, run its request specs, and lint the resulting application. Changes to CLI behavior or templates should include regression coverage.
See AGENTS.md for contributor conventions. AI-assisted work should also follow CLAUDE.md.