← All experiments

No. 059 · Week 47 · Kieran Klaassen · Exploring

InstantRecord: Rails models that run in the browser

A Ruby gem that compiles a Rails app to WebAssembly, so ActiveRecord runs on SQLite in your tab, syncs with the server and works offline.

Can a Rails app feel as instant as Linear, with every read and write on a local database, without leaving Ruby for a JavaScript sync engine?

Linear feels instant because it never waits on the network. Every read and write hits a local database, and syncing happens in the background. Building that today means a JavaScript sync engine, a client-side store and an API layer: a second data architecture that leaves Rails behind.

I wanted to know if I could have it and stay in Ruby. So I wrote a gem. You add one line to a model, and the same model file runs in two places: in your browser tab against SQLite, and on your server against Postgres.

See the rest of the write-up and 3 links.A free Every account opens this. Nothing to buy.