All jobs

Add PWA Support to a SolidJS App

Yes. An agent adds a web manifest, icons and a Workbox service worker to your SolidJS build, keeps the Pages subpath working, proves it offline and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the build and the hosting before adding anything a browser will cache. In an app like solidjs/solid-realworld, rollup.config.js takes src/index.js, runs Babel with babel-preset-solid, emits ES modules into public/ with preserveEntrySignatures: false, so the lazy() imports of Settings and Auth in src/App.js become separate chunks, and a del plugin wipes public/* except public/index.html at the start of every build. .gitignore ignores public/* except that same index.html, which loads ./index.js as a module, pulls the Bootstrap theme from demo.productionready.io, Ionicons and Google Fonts from CDNs, and takes its favicon from a CDN too. Routing is hash-based: src/store/createRouteHandler.js reads window.location.hash.slice(2) and listens for hashchange, and src/store/createAgent.js sends every request to https://api.realworld.io/api with the JWT from localStorage. .github/workflows/gh-pages.yml builds on Node 14 and publishes ./public to GitHub Pages, so the site lives under a repository subpath, which decides how every URL in the manifest and the service worker must be written.

Static files cannot live in public/, since the build deletes them, so the agent adds a static/ directory with manifest.webmanifest and the icons, and rollup-plugin-copy to place them in public/ after the del step on each build. The manifest uses relative values, start_url of ./ and scope of ./, a display of standalone, the app's name from appName in the store, and theme_color matching the green the theme uses for the banner. The only image in the repository is logo.png at 1669 by 257 pixels, a wordmark and not an icon source, so the agent renders a square icon set from the wordmark on a solid background with sharp, at 192 and 512 pixels plus a maskable variant, and says in the pull request that a designed icon should replace them. index.html gains the manifest link, a theme-color meta and an Apple touch icon, all with ./ paths.

The service worker comes from Workbox through rollup-plugin-workbox, generated after the bundle: it precaches public/**/*.{js,html,webmanifest,png} with content hashes, uses index.html as the navigation fallback, which is safe here because every route is a hash fragment on the one page, and adds two runtime routes: NetworkFirst for api.realworld.io so a fresh feed wins when online and the last one shows when not, and StaleWhileRevalidate with cacheableResponse statuses 0 and 200 for the CDN stylesheet and fonts, since those cross-origin responses are opaque and cannot be precached. src/index.js registers ./sw.js after render when navigator.serviceWorker exists, with the relative path that works under the Pages subpath. The workflow's Node 14 is too old for current Workbox, so the agent raises setup-node to a supported version and notes it as a separate decision.

Then it proves the result in the sandbox's browser. It runs npm install and npm run build, serves public/ with the serve package the project already depends on, opens the site in headless Chromium through Playwright, waits for navigator.serviceWorker.ready, reads the manifest the page links to, then sets the context offline and reloads to show the shell renders and the last feed is served from the cache. The build output listing shows sw.js, manifest.webmanifest and the icons beside index.js, and the same checks are added as a small Playwright script under scripts/ so the next person can rerun them.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add PWA support to this SolidJS app. Read package.json, rollup.config.js, public/index.html, .gitignore, the GitHub Pages workflow and every file under src first, and note that public is wiped on each build and the site is served under a repository subpath. Add a static directory with a web manifest and icons copied into public on build, with relative start_url and scope so the subpath works; generate a Workbox service worker after the Rollup build that precaches the built files, falls back to index.html for navigations, uses NetworkFirst for the API origin and StaleWhileRevalidate with opaque responses allowed for the CDN stylesheet and fonts; register it from the entry file with a relative path. Produce the icons from the existing logo on a solid background and say they are placeholders. Raise the workflow's Node version only as far as the tooling needs. Build, serve the output, open it in a browser, wait for the service worker, go offline and reload, and open a pull request with the build listing, the offline check and a Playwright script that repeats it.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request adding static/manifest.webmanifest and static/icons/, changing rollup.config.js (the copy plugin and the Workbox plugin), public/index.html (manifest link, theme colour, touch icon), src/index.js (registration) and package.json (three dev dependencies), with a bump to the Node version in .github/workflows/gh-pages.yml and a scripts/check-pwa.mjs that opens the built site, waits for the worker and reloads offline. The description explains each caching choice, names the icons as placeholders, and states the one behaviour change for users: a cached shell loads before a fresh feed replaces it.

The run's record keeps the Rollup build with the Workbox summary of precached files, the serve session, and the Playwright output with the worker ready and the offline reload rendering the feed. A reviewer reads what happened rather than what should happen.

Before merging, a reviewer opens the preview, installs the app from the browser's prompt, and decides two things the pull request leaves open: whether article pages should be cached beyond the feed, and whether the CDN stylesheet should move into the repository so it can be precached instead of cached at runtime.

Run it on every SolidJS app without a service worker

A developer hands this off from the terminal: one POST /o/{org}/sessions with this body and the repository in resources. A team with several front ends sends one request per repository, each with a request_id that is a UUID v5 of the repository path so a retry returns the run it already started, and the key's webhook_url reports each finished run with its pull request.

Each run reads that app's own bundler, hosting path and API origin, so a Vite app under a root domain gets a different manifest and a different registration path than this Rollup app under a Pages subpath.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

A service worker is easy to add and easy to get subtly wrong: an absolute start_url that breaks under a subpath, a precache that includes opaque CDN responses and fails to install, a build step that deletes the manifest it just copied. The agent reads the real build and the real hosting in its own sandbox and then does what a careful developer does last: opens the built site in a browser, goes offline and reloads, with the result in the run's record.

The pull request carries that proof and a script to repeat it, so the review is about caching policy, which needs a human, rather than about whether the worker installs.

Frequently asked questions

Will the service worker break the GitHub Pages deployment?

No. Every path in the manifest, the registration and the precache is relative, so the app works under the repository subpath Pages serves it from. The same relative paths work under a root domain if the hosting changes.

What happens to the CDN stylesheet and fonts offline?

They are cached at runtime the first time the page loads online, with opaque responses allowed, and served from cache afterwards. They cannot be precached because cross-origin responses without CORS are opaque; moving the stylesheet into the repository would let it be precached, and the pull request suggests that as a follow-up.

Does the feed show stale data?

The API route is NetworkFirst: when online, the fresh response wins and updates the cache; when offline, the last cached response shows. Writes, such as posting an article, are not queued offline; the app behaves as it does today when the network fails.

Why are the icons placeholders?

The repository holds only a wide wordmark, not a square mark. The agent renders a legible square from it so the manifest is complete and installable, and says in the pull request that a designed icon should replace the files in static/icons/.

Why does the workflow's Node version change?

Current Workbox tooling does not run on Node 14, which the Pages workflow pins. The agent raises it only as far as the tooling requires and calls the bump out in the description so it is reviewed as its own decision.

More SolidJS jobs

The same job on other stacks

Keep reading