# Add PWA Support to a Nuxt App

Yes. An agent adds a manifest, icons and a service worker with caching that respects your route rules to a Nuxt app, tests it and opens a pull request.

[Run this on Rush](https://cloud.getrush.ai/run/add-pwa-support/nuxt/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the app's configuration first, because a service worker that ignores it will fight it. In a Nuxt app like nuxt/movies, `nuxt.config.ts` registers five modules, `@vueuse/nuxt`, `@unocss/nuxt`, `@nuxt/image`, `@nuxtjs/i18n` and `@nuxtjs/html-validator`, sets `future.compatibilityVersion: 5`, and has a `routeRules` entry for `/**` with `cache-control: private, no-store`, so every HTML page is deliberately uncached. Data comes from a proxy at `movies-proxy.vercel.app`, and images go through `@nuxt/image`'s `ipx` provider on that same host. `package.json` pins Node 24 and pnpm 11 through `devEngines`, with `pnpm-lock.yaml` and a `pnpm-workspace.yaml` that includes the `proxy` package. `public/` holds `movies.webp`, `movies.png`, `social-card.png` and `robots.txt` but no manifest and no sized icons, and `app/app.vue` sets the favicon through `useHead` with no `theme-color` and no manifest link.

The change adds the `@vite-pwa/nuxt` module to `nuxt.config.ts` with a manifest for the app: `name` and `short_name` from the title `app.vue` already sets, `display: standalone`, a `theme_color` and `background_color` taken from the dark palette in `unocss.config.ts`, where `primary` is defined, and `lang: en`, the `defaultLocale` of the i18n config. Icons at 192 and 512 pixels, plus a maskable one, are generated from `public/movies.png`, which is the only raster logo the repository has. `useHead` in `app.vue` gains a `theme-color` meta tag and an `apple-touch-icon` link next to the existing favicon.

The service worker follows the site's own caching decisions. Because `routeRules` says HTML must not be stored, navigations use a network-first strategy with a small offline fallback page rendered from a new `offline.vue`, never a precached shell that would serve stale pages. API JSON from the proxy host uses network-first with a short expiry, images under the `/ipx/` path use cache-first with a bounded entry count, and the app's hashed build assets are precached, which is what makes the second load fast and the install prompt appear. Registration is `autoUpdate`, so a new deploy replaces the worker on the next visit without a reload prompt the UI does not have.

Then it checks the pieces the repository already checks. `@nuxtjs/html-validator` ignores `.xml`, `.rss` and `.json` paths, so `manifest.webmanifest` is added to its ignore list. It runs `pnpm run lint` with the `@antfu/eslint-config` rules, `pnpm run typecheck` with `vue-tsc`, and `pnpm run test:unit`, the Vitest suite of `*.nuxt.test.ts` files under `app/components` and `app/composables`. It adds a Playwright test in `tests/e2e/` next to `homepage.spec.ts`, using the `@nuxt/test-utils/playwright` fixtures the file already uses, that requests `/manifest.webmanifest`, parses it and checks the name and icon sizes, and asserts the page has a `link[rel=manifest]`. `playwright.config.ts` runs each test on desktop Chrome, desktop Safari and two mobile profiles, so the manifest is fetched under all four. Finally it runs `pnpm build`, serves `.output`, and opens the site in its browser to confirm the manifest and the worker registration in the application panel before opening the pull request.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Do the work the Linear issue describes: add PWA support to this Nuxt app. Read package.json, pnpm-workspace.yaml, nuxt.config.ts, unocss.config.ts, app/app.vue, app/error.vue, app/components/NavBar.vue, the contents of public/, playwright.config.ts, tests/e2e/homepage.spec.ts, vitest.config.ts, eslint.config.js, .github/workflows/tests-unit.yml and .github/workflows/tests-e2e.yml first. Add the @vite-pwa/nuxt module with pnpm and configure it in nuxt.config.ts: a manifest with the app's name and short name, display standalone, theme and background colours from the UnoCSS theme, lang matching the i18n default locale, and 192, 512 and maskable icons generated from public/movies.png. Add a theme-color meta tag and an apple-touch-icon link to the useHead call in app/app.vue. Respect the existing routeRules no-store header: use network-first for navigations with an offline fallback page in a new offline.vue, network-first with a short expiry for JSON from the proxy host, cache-first with a bounded size for images under /ipx/, precache only the hashed build assets, and register with autoUpdate. Add manifest.webmanifest to the html-validator ignore list. Add a Playwright test in tests/e2e using the @nuxt/test-utils/playwright fixtures that fetches /manifest.webmanifest, checks its name and icon sizes, and asserts the page has a link rel=manifest. Run pnpm run lint, pnpm run typecheck, pnpm run test:unit, pnpm build, then pnpm exec playwright test, open the built site in the browser and confirm the manifest and the service worker registration, and open a pull request with what you saw.",
  "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 with changes to `package.json` and `pnpm-lock.yaml`, `nuxt.config.ts`, `app/app.vue`, a new `offline.vue`, new icon files under `public/`, and a new spec under `tests/e2e/`. The description lists the caching strategy per route group in a short table, shows the manifest as served, and states what was not done: no HTML is precached, because `routeRules` forbids storing it, and the TMDB data is never served from cache beyond its short expiry.

The transcript keeps the lint, typecheck, unit and Playwright runs with their output, the `pnpm build` log, and the browser session in which the agent confirmed the registration, with screenshots on the session as artifacts. A reviewer who wants to see the worker's generated code can read it from the build output the agent inspected, quoted in the run.

Before merging, a reviewer checks the manifest colours against the brand, confirms the icon set renders from `movies.png` without a stretched edge on the maskable version, and reads the runtime caching list once more against the `no-store` rule. A follow-up on the same session can add a periodic background sync or change the expiry without a fresh install.

## Run it on every Linear issue labelled agent

Add an automation to the Project with this prompt and a `linear` trigger on `linear.issue.labeled` with the label your team uses for agent work. The labelled issue is appended after the prompt, so an issue that asks for a specific accent colour, a different offline message or a shortcut list in the manifest steers the run with no change to the prompt. A label applied by an app integration never fires the trigger, and `max_runs_per_hour` caps how many runs the automation starts in an hour.

From your own server, send `POST /o/{org}/sessions` with the repository and the issue URL in `resources`, read through your Linear connection, and a `request_id` that is a UUID v5 of the issue id so a redelivered webhook returns the run that already started. Give the key a `webhook_url` and Rush POSTs `run.completed` with `data.session_url` when the pull request is open.

## Why run it on Rush?

A PWA is a set of files that are easy to generate and a set of behaviours that are only visible in a browser: whether the install prompt appears, whether the worker registers, whether a stale page is served after a deploy. The agent runs the production build in its own sandbox with Node 24 and pnpm 11 as `devEngines` pins them, opens the result in a real browser and keeps screenshots of the application panel, so the review has evidence instead of a configuration diff to trust.

The repository's own gates run first: ESLint, `vue-tsc`, Vitest and Playwright across the four device projects, all in the transcript the pull request links to. Several sites can be converted in parallel, each run reading its own `routeRules` and palette rather than applying one fixed worker to all of them.

## Frequently asked questions

### Will the service worker serve stale pages after a deploy?

No. `routeRules` in `nuxt.config.ts` marks every page `no-store`, and the worker respects that: navigations are network-first and only the hashed build assets are precached. With `autoUpdate` registration, a new build replaces the worker on the next visit.

### Does it work offline?

The app shell, icons and already-viewed images load, and a navigation with no network shows the new `offline.vue` page. Movie and TV data comes live from the proxy with a short cache expiry, so a page never seen before cannot be shown offline, which the pull request says plainly.

### Where do the icons come from?

From `public/movies.png`, the only raster logo in the repository, resized to 192 and 512 pixels plus a maskable variant with padding. If the design team has a dedicated icon, replacing those files is the only change needed.

### Does it break the html-validator or the tests?

No. `manifest.webmanifest` is added to the validator's ignore list beside `.xml`, `.rss` and `.json`, and the existing Vitest and Playwright suites run unchanged, with one new Playwright spec added that fetches the manifest on all four device projects.

### What about the fourteen locales?

The manifest takes one `lang`, set to the i18n `defaultLocale`, `en`, and `strategy: no_prefix` means every locale shares the same URLs, so one manifest covers them all. Localised manifest names are not part of this change.

## More Nuxt jobs

- [Add Security Headers to a Nuxt App](https://getrush.ai/run/add-security-headers/nuxt/)
- [Add a Sitemap to a Nuxt App](https://getrush.ai/run/add-sitemap/nuxt/)
- [Add Structured Data (JSON-LD) to a Nuxt App](https://getrush.ai/run/add-structured-data/nuxt/)

## The same job on other stacks

- [Add PWA Support to a React Router v7 App](https://getrush.ai/run/add-pwa-support/react-router/)
- [Add PWA Support to a SolidJS App](https://getrush.ai/run/add-pwa-support/solidjs/)
- [Add PWA Support to a SvelteKit App](https://getrush.ai/run/add-pwa-support/sveltekit/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
