frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Drop-In PWA Support for Next.js with next-PWA-pack

1•devfamdk•6mo ago
Let’s be honest: building a real PWA in Next.js still sucks.

But when you actually need solid offline support, proper cache control, and version updates that don’t leave users stuck with stale data — suddenly you're deep in custom service worker hell, fighting App Router quirks and rewriting logic for the hundredth time.

So we open-sourced next-pwa-pack, a package that wraps all the annoying parts of adding PWA functionality to a Next.js project into something that's finally tolerable.

We do a lot of client work with Next.js, and “can you make it work offline?” comes up more often than you'd think. Every time, it was a mess — building service workers from scratch, wiring up caching strategies, dealing with versioning bugs across tabs, users getting stale content after deployments, etc.

Existing libraries either didn’t support the App Router well or came with so much config overhead that you might as well write your own service worker. So, we did — once — and turned it into a package. next-pwa-pack wires up a service worker with sane defaults: it caches HTML and static assets, supports offline fallback, and comes with a messaging system to control the cache from your app. No extra config required.

It also handles cache invalidation across browser tabs. That one was tricky — we ended up using localStorage + storage events to broadcast update signals, which has been working well for SPAs. To use it, you just wrap your app in the provided PWAProvider. It handles service worker registration, sets up messaging, and optionally gives you a dev panel during local development to observe or trigger cache behavior manually.

import { PWAProvider } from "next-pwa-pack";

export default function layout({ children }) { return <PWAProvider>{children}</PWAProvider>; }

And that’s pretty much it. The service worker kicks in, and you’re immediately getting basic offline support, background caching, and version-aware updates.

When the package is installed, it copies over a default sw.js, manifest.json, and offline.html into your public/ directory (if they don’t exist). These are all editable, of course — but they give you a working baseline.

The service worker handles two types of caching: HTML pages, with a default TTL of 10 minutes (configurable in sw.js).

There's a built-in messaging protocol using postMessage() so the client can ask the SW to update or clear specific caches. You can call things like updateSWCache(['/dashboard']) after a mutation or form submission, or use clearAllCache() after logout.

We also expose a hook (usePWAStatus) for checking things like whether a new version is available, if the service worker is installed, etc. Useful for adding those “update available” banners you see in real-world PWAs.

During dev, enabling devMode in the provider shows a small status widget in the corner that tells you whether the app is online, whether cache is being used, and gives you buttons to clear or disable it. It’s surprisingly helpful.

It only works over HTTPS (as required by the PWA spec), and it only caches GET requests — no API posts or sensitive data. TTLs and exclusions have to be edited in the service worker for now, though we plan to make that configurable via external JSON in the next version.

Also worth noting: if you’re using Incremental Static Regeneration (ISR), this doesn’t yet have direct support — though we’re exploring integration paths there too.

We built this to scratch our own itch, but it’s working well enough that we figured it might be useful to others. No weird magic. Just a working service worker with a nice DX.

Code: https://github.com/dev-family/next-pwa-pack Feedback welcome, and happy to answer questions or hear horror stories about your own PWA setup!

Dev with 5 of experience switched to Rails, what should I be careful about?

1•vampiregrey•1m ago•0 comments

AlphaFace: High Fidelity and Real-Time Face Swapper Robust to Facial Pose

https://arxiv.org/abs/2601.16429
1•PaulHoule•2m ago•0 comments

Scientists discover “levitating” time crystals that you can hold in your hand

https://www.nyu.edu/about/news-publications/news/2026/february/scientists-discover--levitating--t...
1•hhs•4m ago•0 comments

Rammstein – Deutschland (C64 Cover, Real SID, 8-bit – 2019) [video]

https://www.youtube.com/watch?v=3VReIuv1GFo
1•erickhill•5m ago•0 comments

Tell HN: Yet Another Round of Zendesk Spam

1•Philpax•5m ago•0 comments

Postgres Message Queue (PGMQ)

https://github.com/pgmq/pgmq
1•Lwrless•9m ago•0 comments

Show HN: Django-rclone: Database and media backups for Django, powered by rclone

https://github.com/kjnez/django-rclone
1•cui•11m ago•1 comments

NY lawmakers proposed statewide data center moratorium

https://www.niagara-gazette.com/news/local_news/ny-lawmakers-proposed-statewide-data-center-morat...
1•geox•13m ago•0 comments

OpenClaw AI chatbots are running amok – these scientists are listening in

https://www.nature.com/articles/d41586-026-00370-w
2•EA-3167•13m ago•0 comments

Show HN: AI agent forgets user preferences every session. This fixes it

https://www.pref0.com/
5•fliellerjulian•15m ago•0 comments

Introduce the Vouch/Denouncement Contribution Model

https://github.com/ghostty-org/ghostty/pull/10559
2•DustinEchoes•17m ago•0 comments

Show HN: SSHcode – Always-On Claude Code/OpenCode over Tailscale and Hetzner

https://github.com/sultanvaliyev/sshcode
1•sultanvaliyev•17m ago•0 comments

Microsoft appointed a quality czar. He has no direct reports and no budget

https://jpcaparas.medium.com/microsoft-appointed-a-quality-czar-he-has-no-direct-reports-and-no-b...
2•RickJWagner•19m ago•0 comments

Multi-agent coordination on Claude Code: 8 production pain points and patterns

https://gist.github.com/sigalovskinick/6cc1cef061f76b7edd198e0ebc863397
1•nikolasi•20m ago•0 comments

Washington Post CEO Will Lewis Steps Down After Stormy Tenure

https://www.nytimes.com/2026/02/07/technology/washington-post-will-lewis.html
7•jbegley•20m ago•1 comments

DevXT – Building the Future with AI That Acts

https://devxt.com
2•superpecmuscles•21m ago•4 comments

A Minimal OpenClaw Built with the OpenCode SDK

https://github.com/CefBoud/MonClaw
1•cefboud•21m ago•0 comments

The silent death of Good Code

https://amit.prasad.me/blog/rip-good-code
3•amitprasad•22m ago•0 comments

The Internal Negotiation You Have When Your Heart Rate Gets Uncomfortable

https://www.vo2maxpro.com/blog/internal-negotiation-heart-rate
1•GoodluckH•23m ago•0 comments

Show HN: Glance – Fast CSV inspection for the terminal (SIMD-accelerated)

https://github.com/AveryClapp/glance
2•AveryClapp•24m ago•0 comments

Busy for the Next Fifty to Sixty Bud

https://pestlemortar.substack.com/p/busy-for-the-next-fifty-to-sixty-had-all-my-money-in-bitcoin-...
1•mithradiumn•25m ago•0 comments

Imperative

https://pestlemortar.substack.com/p/imperative
1•mithradiumn•26m ago•0 comments

Show HN: I decomposed 87 tasks to find where AI agents structurally collapse

https://github.com/XxCotHGxX/Instruction_Entropy
2•XxCotHGxX•30m ago•1 comments

I went back to Linux and it was a mistake

https://www.theverge.com/report/875077/linux-was-a-mistake
3•timpera•31m ago•1 comments

Octrafic – open-source AI-assisted API testing from the CLI

https://github.com/Octrafic/octrafic-cli
1•mbadyl•32m ago•1 comments

US Accuses China of Secret Nuclear Testing

https://www.reuters.com/world/china/trump-has-been-clear-wanting-new-nuclear-arms-control-treaty-...
3•jandrewrogers•33m ago•2 comments

Peacock. A New Programming Language

2•hashhooshy•38m ago•1 comments

A postcard arrived: 'If you're reading this I'm dead, and I really liked you'

https://www.washingtonpost.com/lifestyle/2026/02/07/postcard-death-teacher-glickman/
4•bookofjoe•39m ago•1 comments

What to know about the software selloff

https://www.morningstar.com/markets/what-know-about-software-stock-selloff
2•RickJWagner•43m ago•0 comments

Show HN: Syntux – generative UI for websites, not agents

https://www.getsyntux.com/
3•Goose78•43m ago•0 comments