Skip to content

feat: Adding basic PWA support#19173

Open
jetpham wants to merge 6 commits intoanomalyco:devfrom
jetpham:jet/pwa-support
Open

feat: Adding basic PWA support#19173
jetpham wants to merge 6 commits intoanomalyco:devfrom
jetpham:jet/pwa-support

Conversation

@jetpham
Copy link
Copy Markdown

@jetpham jetpham commented Mar 25, 2026

Issue for this PR

Closes #19174

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This adds basic PWA support for the web app so OpenCode feels more like an installed app and can keep its core shell available offline.
I added the mobile web app metadata in packages/app/index.html, updated the manifest with install settings like start_url, scope, fullscreen display options, and icon purposes, and registered a service worker from packages/app/src/entry.tsx. The new packages/app/public/sw.js caches the app shell and key static assets, uses cached assets when it can, and falls back to the cached root document for navigation requests when the network is unavailable. I also updated packages/app/public/_headers so the manifest and service worker are served with the right content types and service worker headers.
This works because browsers need the manifest, install metadata, and service worker together for installability and offline support. Caching the shell assets gives the app something reliable to load when the network drops, and the added headers make sure those files are recognized and scoped correctly by the browser. One thing I like is that this keeps a single persistent instance of the app open rather than opening multiple instances in the browser.

How did you verify your code works?

I ran the opencode web application and served it locally onto my network, then opened it on my phone and installed the PWA. Screenshots attached.

Screenshots / recordings

Screenshot_20260324-214451 Screenshot_20260324-214428 Screenshot_20260324-214432 Screenshot_20260324-214437

Screenshot_20260324-214444 Screenshot_20260324-214451 Screenshot_20260324-214453 Screenshot_20260324-214455

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jetpham jetpham requested a review from adamdotdevin as a code owner March 25, 2026 21:23
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Jet/pwa support doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potential duplicate:

This PR appears to directly address the same feature as PR #19173. Both PRs are implementing PWA (Progressive Web App) support with a service worker for caching assets. PR #19122 specifically mentions "add PWA service worker for asset caching," which overlaps with the core functionality described in the current PR (registering a service worker to cache the app shell and static assets).

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@jetpham jetpham changed the title Jet/pwa support feat: Adding basic PWA support Mar 25, 2026
@masrurimz
Copy link
Copy Markdown

got similiar PR #19122
hope this can be merge soon

@squat
Copy link
Copy Markdown

squat commented Apr 9, 2026

I'm eager to test out this patch on my install but there seems to be a merge conflict with index.html that prevents the patch from applying cleanly. Could you rebase?

@squat
Copy link
Copy Markdown

squat commented Apr 9, 2026

🚀 I added this PR as a patch on my Nix derivation for opencode and can confirm this works!
Screenshot_20260410-003231

@jetpham
Copy link
Copy Markdown
Author

jetpham commented Apr 9, 2026

I hit Test timeout of 60000ms exceeded. . The windows CI is broken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Adding basic PWA support

3 participants