Skip to content

About

Coldwire: ☁️🧊 Offline toolkit for Hotwire Native, Hotwire, Turbo, PWA's in Rails

Resources

Stars

38 stars

Watchers

1 watching

Forks

Latest commit

 

History

146 Commits

Folders and files

Repository files navigation

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.

About

Coldwire: ☁️🧊 Offline toolkit for Hotwire Native, Hotwire, Turbo, PWA's in Rails

Resources

Stars

38 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages