{
  "id": "c888428c8fec5197eeb62d90",
  "source": "solid:signals",
  "type": "github-document",
  "title": "service-workers",
  "content": "---\ntitle: Service workers\nuse_cases: \u003e-\n  offline support, pwa, caching, background sync, push notifications,\n  performance optimization\ntags:\n  - service-workers\n  - pwa\n  - offline\n  - caching\n  - performance\nversion: '1.0'\ndescription: \u003e-\n  Register and configure service workers in SolidStart for offline support,\n  caching strategies, and progressive web app features.\n---\n\nTo register a service worker:\n\n1. Place your service-worker file in the `public` directory (e.g., `public/sw.js`), making it available at the root URL (`/sw.js`).\n2. Add registration logic to the `entry-client.tsx` file.\n\n```tsx {6-11} title=\"src/entry-client.tsx\"\n// @refresh reload\nimport { mount, StartClient } from \"@solidjs/start/client\";\n\nmount(() =\u003e \u003cStartClient /\u003e, document.getElementById(\"app\")!);\n\nif (\"serviceWorker\" in navigator \u0026\u0026 import.meta.env.PROD) {\n\twindow.addEventListener(\"load\", () =\u003e {\n\t\tnavigator.serviceWorker.register(\"/sw.js\");\n\t});\n}\n```",
  "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-start/guides/service-workers.mdx",
  "metadata": {
    "path": "src/routes/solid-start/guides/service-workers.mdx",
    "repo": "solidjs/solid-docs",
    "repo_url": "https://github.com/solidjs/solid-docs.git",
    "size": 947,
    "source_type": "github"
  },
  "hash": "f5af2a6bceee4933431349b045d1ddcefaa2350e008c3e4569e5b46e75d14ef6",
  "timestamp": "2026-02-23T11:43:00.19432407+01:00"
}