For NextJS 13/14/15 using App Router, you can download sw.js file an put it on /public folder
NextJS 13/14/15
App Router
/public