When your Hotwire wires go cold.
Offline caching for Rails, extracted from a production app. Add a gem, mount it, drop a tag in your layout — pages start working without a network. A service worker precaches what you nominate, keeps pages as people browse, and falls back to a view Turbo will actually render.
Works the same in a plain web app, an installed PWA, or Hotwire Native.
Tip
Need help going offline? Coldwire is built by Noreaster Group. If you want a hand adding offline to your Hotwire or Hotwire Native app, talk to us.
- Setup in 30 seconds: Install gem, then
bin/rails coldwire:install. The rest has working defaults. - Cache as you go: Defaults to all pages get cached as your navigate, customize to only cache certain parts of the app.
- Auto Sycn precaching: Define urls that can be pre-cached automatically in the background.
- Garbage collection: Entries nothing has used in two months are swept, and anything over the storage ceiling goes least recently read first — so the cache doesn't grow forever. Only with a connection; anything a page still loads is renewed on the way past. People can set the ceiling for their own device on
/offline. - Offline fallback page: A customizable page when a user is offline and no page is cached for that given url.
- Offline settings page: at
/offline: turn offline support off, force offline, sync, downloads, inspect what's cached. - Easy Tailwind Variants: Easily show or hide content with an
online:oroffline:Tailwind variant.
The offline settings page (Inspect cache is the URL list), and the fallback when a page isn't cached.
# Gemfile
gem "coldwire-rails"bin/rails coldwire:installThat mounts the engine at /offline, writes config/initializers/coldwire.rb, registers
the Stimulus controller, and adds the tag to your layout. Visit /offline to see what's
cached.
For signed-in apps that do not use current_user or Current.user, set cache_identity.
To have pages ready before anyone visits them, turn on auto_sync. Both are in the
configuration reference.
- Setup — install, requirements, Hotwire Native on iOS
- Configuration — every option and what it does
- How it works — why a naive cache fails in Hotwire
MIT. See LICENSE.



