r/ruby • • 19h ago

Snails is a Rails-like framework for API-only Ruby apps.

https://snails-rb.org/

Snails builds on Matz's Spinel to compile apps into a single native binary, minus Active Record, server-rendered views and gems. It keeps the Rails conventions and builds the framework in plain Ruby. One process, multi-threaded, across all cores: no worker processes, no GVL. On the benchmark, Snails serves about 3× the requests per second of Rails in cluster mode, with more than 10× lower peak memory under load.

Site: https://snails-rb.org/
Repository: https://github.com/snails-rb/snails

10 Upvotes

3 comments sorted by

1

u/ugh_you_swine 11h ago

You might want to check out https://github.com/roundhouse-rb/roundhouse

It'll let you take an existing Rails app and transpile it to C (spinel) and other languages (Go, Python, etc.).

1

u/kslrinn 7h ago

Fair point. roundhouse has more targets than the Spinel one I tried. That target runs the Rails runtime, so AR and the gems come with it; the other targets drop Rails at runtime, but the source stays Rails and the output is generated code in another language. If I wanted Go or Rust, I'd port directly, as I did for one worker. My constraint was the stack, not the target language, so I create a framework rather than a transpiler.

longer version here: https://snails-rb.org/blog/a-native-rails-like-ruby-app-using-20-mb-of-memory/#roundhouse-kept-the-rails-stack

1

u/KontoOficjalneMR 3h ago edited 3h ago

I gave up after two paragraphs of meaningless AI slop in README.

Shame because sounds interesting.

Edit: Holy shit, it's basically a framework for AI bots to clone Rails project into another framework while verifying that it kinda produces same output (kinda because there's no formal proof, just AI coded test framework that checks in under test conditions same endpoint produces same output).