Remix PWA
repository·main·Indexed 41 days ago
https://github.com/remix-pwa/monorepoA suite of libraries and utilities for integrating Progressive Web App (PWA) capabilities into Remix applications. It includes tools for service workers, offline capabilities, and web app manifests via packages such as @remix-pwa/client, @remix-pwa/cache, @remix-pwa/push, and @remix-pwa/sync. The ecosystem features a CLI for generating manifests and service workers, a specialized worker runtime, and React hooks for monitoring network connectivity, battery status, and app badging.
What's inside Remix PWA
- Remix PWA is a collection of JavaScript libraries and utilities designed to simplify the process of building Progressive Web Apps (PWAs) using the Remix framework. It provides the necessary tools to implement PWA features like service workers, offline capabilities, and web app manifests within a Remix application.
Use the Remix PWA playground
mainThe Remix PWA playground is a sandbox environment designed for testing Remix PWA features. It allows developers to experiment with different configurations and features in a consequence-free environment to understand how they behave before implementing them in a production application.Testing strategy for @remix-pwa/client
mainThe@remix-pwa/clientpackage does not include automated tests. Because the package is built entirely on Project Fugu APIs (which are only available in modern browsers), mocking these features for a testing environment is highly complex. Developers using or contributing to this package should rely on manual testing and intuition rather than looking for an existing test suite.Use Vitest for testing in Remix PWA
mainRemix PWA uses Vitest as its primary testing framework instead of Jest. Vitest is built on top of Vite and esbuild, providing a fast, lightweight, and highly configurable testing environment. If you are contributing to or building on top of Remix PWA, you should use Vitest to align with the project's testing infrastructure and benefit from its performance (the entire test suite currently averages approximately 400ms).Understand the role of @remix-pwa/dev
mainThe
@remix-pwa/devpackage is the core engine of the Remix PWA development experience. It provides the compiler, dev server, build system, and the CLI engine.Important: This package is an internal engine and is not intended to be used directly as a dependency within your Remix application code. It is designed to power the development and build workflows of the Remix PWA ecosystem.
Understand the role of @remix-pwa/worker-runtime
mainThe
@remix-pwa/worker-runtimepackage provides a runtime for executing vanilla JavaScript service workers within a Remix Application. It functions as a bridge between the service worker and the client.Note: This package is not intended for direct use within your Remix application code; it is a specialized runtime component.
Understanding the @remix-pwa/cache package
mainThe
@remix-pwa/cachepackage is a standalone, flexible, and extensible caching engine designed to cache any resource. It serves as the core caching powerhouse forremix-pwaand is designed to work alongside@remix-pwa/sw@^2.x.xto provide a robust offline experience.Unlike previous versions that were highly opinionated and difficult to override,
@remix-pwa/cacheis built to be heavily pluggable and integrates well with external tools likecachifiedandnode-lru-cache. It is intended to solve limitations regarding document caching and general flexibility in how resources are stored and retrieved.Understand the caching architecture with @remix-pwa/cache and Cachified
mainThe
@remix-pwa/cachepackage provides caching capabilities for Remix by leveraging the WebCacheAPI and integratingcachifiednatively.Key architectural benefits include:
- Unified Caching: The same caching solution can be used for both the client and the server, ensuring a consistent experience.
- Extensibility: It supports built-in extensibility for Redis and in-memory caching. Developers can also implement custom solutions that work alongside the browser
CacheAPI. - Worker Integration: The architecture is designed to work with the approach of bringing worker threads directly into Remix loaders and actions.
- Flexibility: Because
cachifiedis less opinionated, it allows for flexible implementation patterns compared to previous version-based strategy approaches.
Install @remix-pwa/push
mainTo use the
@remix-pwa/pushpackage in your project, install it via npm.npm install @remix-pwa/pushInstall @remix-pwa/worker-runtime
mainYou can install the worker runtime using npm:
npm install @remix-pwa/worker-runtimeUse @remix-pwa/sync for Background Sync
mainThe
@remix-pwa/syncpackage provides a wrapper around the Background Sync API to simplify integrating background synchronization into your Remix app.For detailed implementation guides and usage patterns, refer to the official documentation at: https://remix-pwa.run/docs/background-sync
Install @remix-pwa/sync
mainTo add Background Sync capabilities to your Remix application, install the
@remix-pwa/syncpackage via npm.npm install @remix-pwa/sync