Skip to content

feat: Enable JSONP Dev Toolkit to function as a Progressive Web App with offline access #63

Description

@zhravan

Summary:

Turn JSONP – Dev Toolkit into a Progressive Web App (PWA) by adding a web app manifest and service worker, enabling installation on devices and offline functionality.

Motivation/Problem:

Users currently need an internet connection to load JSONP. Making it a PWA improves reliability, performance, and UX by caching core assets and providing an offline fallback.

User Stories

  1. As a developer, I want to install JSONP on my desktop or mobile home screen so that I can quickly access it like a native app.
  2. As a user, I want JSONP to load even when I’m offline or on a flaky network so that I can format or compare JSON anytime.
  • Acceptance Criteria:
    1. Add manifest.json with icons, start_url, theme and background colors.
    2. Create and register a service-worker.js that precaches all essential assets (HTML, CSS, JS, icons, offline page).
    3. Provide an offline.html fallback when navigation fails.
    4. Enable “Add to Home Screen” prompt in supported browsers.
    5. Assets update seamlessly on new deployments, and stale caches are cleaned up.
    6. Document PWA installation steps and offline behavior in README.

💡 Proposed Implementation

  1. Manifest: Create /manifest.json and link it in <head> of index.html.
  2. Service Worker:
    • Use Cache API to pre-cache core assets on install.
    • On fetch for navigation requests, try network first then fallback to offline.html.
    • For other resources, serve from cache-first strategy with runtime cache update.
  3. Offline Page: Minimal /offline.html as user-friendly fallback.
  4. Register SW: Add registration code in index.js when window loads.
  5. Cache Versioning: Implement CACHE_NAME with version and clear old caches on activate.
  6. Documentation: Update README with PWA badges, usage, and testing instructions.

⚖️ Alternatives Considered

  • Workbox: Pros: richer utilities, precaching and routing helpers. Cons: additional build dependency and bundle size.
  • Runtime-only caching: Pros: simpler. Cons: users may see broken UI on initial load when offline.

Impact

  • Affected modules: frontend assets, README documentation.
  • User impact: improved reliability and engagement (installable app).
  • Effort estimate: Medium (≈ 2–3 working days).
  • Dependencies: None external; use native Service Worker API.

Mockups / Examples

  • Install prompt screenshot.
  • Offline message design for /offline.html.

Additional Context

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions