crails

Version, currently main branch1 version
  • main branchlatestNov 5, 2026

github.com/OrelSokolov/crails

Rails-port MVC framework on Crystal — the crails CLI and the full-stack framework

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  crails:
    github: OrelSokolov/crails
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 1.21.0
License
MIT
Target
  • crails from src/crails_cli.cr

Dependencies

Runtime Dependencies

README

CRails — Clean Rails - The most beautiful compiled web framework

Current status: a port of Ruby on Rails. At this point CRails is simply a port of Ruby on Rails to Crystal. We are porting the framework in its current form: the framework itself, its spirit and the beauty of its code. The code is being ported from Rails one-to-one, so that refactoring can happen later — this is a draft, not even a first release.

Philosophy

The project's philosophy — explicit contracts first, lessons from Rails and Ruby, why Crystal and not Rust, and the promises the framework intends to keep — lives in IDEA.md. It is effectively a roadmap and a promise for the future, not a description of what is already implemented.

Desktop and mobile now! NEW

CRails doesn't end at the server. With positron.cr the same stack ships desktop and mobile applications — go desktop, go mobile:

  • the backend is a regular CRails application;
  • the frontend is still plain HTML + CSS;
  • all data work — models, queries, validations — lives on ActiveRecord (active_record.cr), embedded right into the client.

Compilation to a single native binary is what makes this possible: the whole app — views, models and the database layer — ships as one executable that runs as a native desktop application — a whole new world for desktop apps.

Installation

Install with carat package manager to get the binary:

carat install OrelSokolov/crails
crails new helloworld

The best performance in class

Median RPS, official once-campfire-verification harness, AMD Ryzen 9 3900X stand:

RouteRailsExpressGoRustCElixirCRails
room_show1 73110 43014 31621 95331 6982 34638 092
messages_page1 64116 24814 33621 53932 1142 48037 553
sidebar1 80419 97914 94524 41134 8572 56652 299
search1 80117 76415 98825 11333 4602 52248 930
avatar28 04640 98948 65674 44218 92031 89676 669
static_css37 04842 84359 41372 38937 09536 78875 962
/up2 57120 53129 23836 55762 8904 23082 265
post_message1661 0152 4422 9351 3035562 033

Beats Rust in some cases, but with beautiful code and the MVC pattern — see more at the original repository.

Ecosystem

CRails is assembled from standalone shards, each living in its own repo under github.com/OrelSokolov:

Base (resolved by the root shard.yml):

Optional layers (add to your app's shard.yml when needed):

License

MIT

What this is

A full clone of the Ruby on Rails API on Crystal, as 1:1 as possible in the end interface — so that a developer moving from Ruby/Rails feels no difference. Goal: Rails application code ports to Crystal nearly verbatim.

The practical differences from Ruby on Rails — the CRails namespace, ERB → ECR, the crails command, nilable finders, keyword arguments, type narrowing and other consequences of Crystal's static typing — are collected in DIFFERENCES.md.