0.01
The project is in a healthy, maintained state
When your Hotwire wires go cold. A Rails engine that serves a Cache API service worker, precaches the pages you nominate, and falls back to an offline view Turbo will actually render. Built against Hotwire Native's rules, which are stricter than a browser's, so the same cache works in a plain Hotwire web app and an installed PWA.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 7.1
 Project Readme
Coldwire

When your Hotwire wires go cold.

Gem Gem

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

Noreaster Group

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.

What you get

  • 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: or offline: Tailwind variant.

Offline settings: status, force offline, the storage limit, auto sync, and downloads Offline settings: every cached entry, with search, sort, and delete The offline fallback: You're offline. This page isn't available offline. Reconnect and try again.

The offline settings page (Inspect cache is the URL list), and the fallback when a page isn't cached.

Quick start

# Gemfile
gem "coldwire-rails"
bin/rails coldwire:install

That 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.

Docs

  • Setup — install, requirements, Hotwire Native on iOS
  • Configuration — every option and what it does
  • How it works — why a naive cache fails in Hotwire

License

MIT. See LICENSE.