📌 Routing in Mosaik
Mosaik embraces Next.js’ built-in routing to the fullest — keeping things simple, fast, and familiar.
Each page in Mosaik is a Next.js route file that defines which themeable component to render, what data to fetch, and how to link it all together. We never reinvent the router — instead, Mosaik’s makeMosaikPage helper lets you wire up:
Dynamic routes: Use app/ directory route segments like /mosaik/:section or /mosaik/blog/:slug to map directly to URL patterns.
Built-in params: Route parameters (params) are passed through Next’s native system — so you benefit from file-based routing, static generation (generateStaticParams), and ISR out of the box.
Custom view logic: Instead of a custom router, AppRouter (or ViewPortal) simply plugs in the correct React component for each section, with the data it needs.
Key idea: Mosaik is not a router — Next.js is. Mosaik just gives you a clean, composable pattern to resolve content dynamically, while Next handles all the heavy lifting: URL matching, static generation, and revalidation.
Highlights:
✅ Fully compatible with Next.js 13+ App Router and Server Components
✅ Dynamic routes are statically generated where possible for performance
✅ Data fetching happens server-side, with ISR (revalidate) support
✅ No unnecessary client-side router abstractions
If you know how Next.js routing works — you already know how Mosaik routes work. That’s intentional: simplicity is the framework.