Skip to content

PWA (installable, offline) and 12 → 8 serverless functions - #21

Merged
nannndev merged 2 commits into
mainfrom
claude/exciting-bell-qakqv7
Sep 27, 2026
Merged

nannndev merged 2 commits into
mainfrom
claude/exciting-bell-qakqv7

Conversation

@nannndev

Copy link
Copy Markdown
Owner

Summary

Fewer functions (12 → 8)

  • The daily and ranked routes (3 files each) move to api/_lib/routes/.
  • api/daily.ts and api/ranked.ts dispatch by action.
  • vercel.json rewrites /api/daily/:action and /api/ranked/:action, so client URLs are unchanged.
  • This frees 4 function slots for future features, such as real push notifications.

PWA

  • vite-plugin-pwa precaches the app shell and every chunk (~2 MB). Practice keeps working offline with built-in snippets, words and passages.
  • Toasts:
    • "New version ready → Reload". The page never auto-reloads, so an update cannot interrupt a run.
    • An offline indicator.
    • "Ready offline" on first install.
  • A "Codey app" card in Settings: an Install button on Chrome/Edge, and an Add to Home Screen hint on iOS.
  • The manifest gets id, scope and shortcuts (Daily, Duel, Stats).
  • sw.js is served with Cache-Control: no-cache.
  • Streak reminders fall back to registration.showNotification where page notifications are not allowed (Android Chrome).

Test plan

  • vitest: 177 tests pass, including new dispatch and pwa tests. The function-count guard now sees 8 functions.
  • tsc -b and the build pass.
  • Browser (vite preview): the service worker installed, and after going offline a reload still rendered practice and Settings.
  • Vercel preview deploy on this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_018xNjY7412Rp5bFuw5h69yu


Generated by Claude Code

The six route files move to api/_lib/routes; api/daily.ts and
api/ranked.ts dispatch by action, and vercel.json rewrites the old
/api/<group>/<action> URLs so clients are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018xNjY7412Rp5bFuw5h69yu
vite-plugin-pwa precaches the app shell and every chunk, so practice
(built-in snippets, words, passages) keeps working without a network.
A toast offers new versions instead of reloading mid-run, and says when
you are offline. Settings gets an install card (prompt on Chrome/Edge,
Add to Home Screen on iOS). Streak reminders fall back to the service
worker where the page cannot show notifications (Android Chrome).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018xNjY7412Rp5bFuw5h69yu
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
codetype Ready Ready Preview Sep 27, 2026 9:04am UTC

@nannndev
nannndev merged commit d1cbf88 into main Sep 27, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1a838b70 Deployed Sep 27, 2026 by vercel[bot]
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.

2 participants