next-router-segments

Parsing Next.js pathname to structured segments, which you can use in various ways.