Skip to content

feat(tinytorch): make the website an installable PWA - #1944

Closed
farhan523 wants to merge 1 commit into
harvard-edge:devfrom
farhan523:feat/tinytorch-pwa
Closed

feat(tinytorch): make the website an installable PWA#1944
farhan523 wants to merge 1 commit into
harvard-edge:devfrom
farhan523:feat/tinytorch-pwa

Conversation

@farhan523

Copy link
Copy Markdown
Contributor

Summary

Makes the TinyTorch site (mlsysbook.ai/tinytorch/) an installable Progressive Web App with offline reading support.

  • manifest.webmanifest — installability metadata with relative start_url/scope so it resolves correctly both under /tinytorch/ in production and in local previews served at the root. Includes any + maskable icons (192/512) generated from the flame mark in logo-tinytorch-simple.png, themed with the existing #D4740C brand color.
  • sw.js (service worker) — conservative caching tuned for a frequently-deployed docs site:
    • Pages: network-first. A deploy is picked up immediately; the cache is only an offline fallback, with a branded offline page as the last resort.
    • Same-origin static assets (css/js/images/fonts): stale-while-revalidate, capped at 200 entries.
    • JSON/data passthroughrelease-manifest.json, search.json, and any fetch/XHR always hit the network, so the release pill and search never go stale.
    • Cross-origin CDN requests (Google Fonts, cdnjs) are left to the browser.
  • assets/scripts/pwa.html — registers the worker at the site base path, derived at runtime because pages render at several directory depths and the site root differs between production (/tinytorch/) and previews (/). Registration is skipped silently on insecure contexts.
  • apple-touch-icon fix — the previous href pointed at the 583×328 wordmark; iOS home screens now get a proper 180×180 icon. The manifest <link> and icon use leading-/ project-relative hrefs, which Quarto relativizes per page depth.

No changes to page content or build tooling; quarto render output just gains the manifest, worker, and icons via the existing resources: mechanism, so the publish workflow deploys them as-is.

Testing

  • quarto render passes; verified the manifest link and icon hrefs relativize correctly at all page depths (index.html, modules/, tito/).
  • Served _build locally: all PWA URLs return 200, manifest parses, node --check sw.js passes.
  • Verified in Chrome: install prompt appears, worker activates with site-wide scope, visited pages load offline, unvisited pages show the offline fallback.

Add web app manifest, service worker, and app icons so the TinyTorch
site can be installed to the home screen and read offline.

- manifest.webmanifest with relative start_url/scope so it works both
  at mlsysbook.ai/tinytorch/ and in local previews; any + maskable
  icons generated from the flame mark in logo-tinytorch-simple.png
- sw.js: network-first for pages (never stale after a deploy, cached
  fallback offline, branded offline page as last resort),
  stale-while-revalidate for same-origin css/js/images/fonts,
  passthrough for JSON/data so release-manifest and search stay live
- assets/scripts/pwa.html registers the worker at the site base path,
  derived at runtime since pages render at several directory depths
- fix apple-touch-icon to a real 180x180 icon (the old href pointed at
  the 583x328 wordmark)
@github-actions github-actions Bot added area: tinytorch TinyTorch framework core type: improvement Improve existing content labels Jul 7, 2026

@Shashank-Tripathi-07 Shashank-Tripathi-07 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @farhan523 .

Totally like and appreciate the idea of bringing TinyTorch from the current infra to a PWA, but we're currently focusing on stabilizing and making the current TinyTorch system so as to prepare for it's major release and hence, I can't merge this PR and I've to close it. You can instead focus on surgical changes and changes that make TinyTorch better for release rather than pushing major changes to TinyTorch for now. Thanks !

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

Labels

area: tinytorch TinyTorch framework core type: improvement Improve existing content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants