Short answer Keep pages as Server Components and push 'use client' down to the smallest interactive piece. Never wrap a layout in ssr: false. Treat saved browser state and entrance animations as hydration and LCP hazards. Pin exact versions for workers and native modules, and pin the workspace root in monorepos. Each lesson below came from a real build.
Our old version of this post claimed lessons from "20+ projects". That wasn't a number we could stand behind, so this rewrite sticks to five App Router codebases we can open and point at.
Which builds are these lessons from?
| Build | Next.js version | Built | What it is |
|---|---|---|---|
| B.S. Desai | 14.2 | Dec 2025 to Apr 2026 | Bilingual artist portfolio with a WhatsApp enquiry cart and a catalogue flipbook |
| FlyHigh Pre School | 14.2 | Apr to May 2026 | Ten-page admissions site with video, motion and structured data |
| A temple management system | 16.1 | Mar to Jul 2026 | Counter billing, donations with PDF receipts, inventory, expenses, reports |
| A retail point of sale | 16.3 | Aug 2026 onward, in development | Offline-first till app and cloud owner dashboard in a pnpm monorepo |
| This website | 15.5 | Jul to Sep 2026 | Statically generated marketing site and blog |
Our previous studio site, on Next.js 16.1, supplied the most expensive lesson, so it's in here too.
Where should 'use client' go?
On the smallest thing that needs the browser. Not on the page.
On B.S. Desai we marked most page files 'use client', including the artwork detail page, because they read from client-side stores for the cart and the language toggle. A client page can't export metadata or generateMetadata. The result, checked on 29 September 2026: /gallery, /about, /exhibitions and /gallery/1 all share the same title tag. Twenty-one artworks, one title.
Four months later on Fly High we split routes into a server page.tsx, which exports its own metadata and canonical URL, and a client component for the interactive parts, such as ContactPageClient.tsx. The pattern we use now:
// app/gallery/[id]/page.tsx: a Server Component
import { artworks } from '@/data/artworks'
import EnquiryButton from './EnquiryButton' // 'use client', the only interactive part
export const dynamicParams = false
export const generateStaticParams = () => artworks.map((a) => ({ id: a.id }))
type Props = { params: Promise<{ id: string }> }
export async function generateMetadata({ params }: Props) {
const { id } = await params
const art = artworks.find((a) => a.id === id)
return { title: art ? `${art.title} by B.S. Desai` : 'Artwork' }
}
export default async function ArtworkPage({ params }: Props) {
const { id } = await params
const art = artworks.find((a) => a.id === id)!
return (
<article>
<h1>{art.title}</h1>
<EnquiryButton id={art.id} />
</article>
)
}(params is a Promise from Next.js 15. On 14, it's a plain object.)
What happens if you wrap a layout in ssr: false?
Everything inside it disappears from the HTML. On our previous studio site, a provider loaded with next/dynamic and ssr: false wrapped the whole layout. Browsers and Google rendered it fine. AI crawlers, which don't run JavaScript, received a page with zero words and no H1 for more than five months. We wrote up the details in why ChatGPT couldn't read our website.
ssr: false is fine at the leaves. B.S. Desai's exhibition flipbook uses it correctly: PDF rendering needs browser APIs, and the component has no children. This site's hero particle canvas uses it the same way.
How do you use localStorage without hydration errors?
B.S. Desai's enquiry cart is a Zustand store persisted to localStorage, so a visitor's picks survive a refresh. The server can't see localStorage, so it renders an empty cart, while the browser renders three items. React flags the mismatch.
The fix is to render the server's version first and switch after mount:
'use client'
import { useEffect, useState } from 'react'
export function useHasMounted() {
const [mounted, setMounted] = useState(false)
useEffect(() => setMounted(true), [])
return mounted
}
// in the navbar: the badge appears after hydration
const mounted = useHasMounted()
{mounted && cart.length > 0 && <span className="badge">{cart.length}</span>}That's right for a cart badge. It's wrong for content. The same site's English and Kannada toggle lives in client state, so the Kannada text never has a URL of its own and crawlers only ever see English. Google recommends "different URLs for each language version of a page" rather than cookies or browser settings (Google: multilingual sites). If a second language matters for search, give it routes, like /kn/gallery.
Do entrance animations hurt performance?
They hurt Largest Contentful Paint, because the browser doesn't count an element with opacity: 0 as painted. Fly High wraps every page in a Framer Motion transition that starts at opacity: 0 in the server HTML, and B.S. Desai fades in its H1. In our Lighthouse runs, their LCPs were 3.3 and 4.7 seconds, with most of the time spent waiting for JavaScript (measurements and method).
The rule we follow now: the largest thing on the first screen starts visible. Animate its position or scale if you must, never its opacity from zero. And respect prefers-reduced-motion. Fly High's transition wrapper already skips the animation for visitors who ask for less motion.
Why pin exact versions for client-only libraries?
B.S. Desai's flipbook renders PDFs with react-pdf, which runs PDF.js in a web worker loaded from a URL. The worker URL named version 3.11.174, while package.json allowed ^3.11.174. When the installed library and the worker drifted apart, the flipbook broke. The April 2026 fix was two changes: exact versions in package.json, and a worker URL built from pdfjs.version so the two can never disagree.
Anything loaded at runtime from outside your bundle, such as workers, WebAssembly or CDN scripts, should be pinned to the exact version your code was built against.
How do you run Next.js on a shop counter?
The retail point of sale runs its till app on the shop's own Windows computer, and it has to keep billing when the internet drops. Most of what made that work was configuration:
// apps/pos/next.config.ts
import path from 'node:path'
import type { NextConfig } from 'next'
const workspaceRoot = path.join(import.meta.dirname, '../../')
const nextConfig: NextConfig = {
output: 'standalone', // ship `node server.js` to the till
outputFileTracingRoot: workspaceRoot, // pin the monorepo root for builds...
turbopack: { root: workspaceRoot }, // ...and for the dev watcher
serverExternalPackages: ['better-sqlite3', 'pino'], // native or self-resolving: don't bundle
transpilePackages: ['@pos/db', '@pos/domain'], // workspace packages ship TypeScript
}
export default nextConfigThe two root settings came from an incident. A stray lockfile in a developer's home folder made Next.js decide the home folder was the project root. Turbopack's dev watcher then crawled every file under it, pegging CPU and memory on the development machine. Pinning the root explicitly fixed it regardless of what else sits on the disk.
Where should business logic live?
In the database transaction, not in React. The temple management system handles money at a counter, so:
- Money is stored as integer paise, never as floating-point rupees.
- Receipt numbers are generated inside the same transaction as the sale, with a
SELECT … FOR UPDATElock, so two counters can't issue the same number. - Every route handler checks auth and validates input with Zod before touching the database.
- Donation receipts are generated as PDFs on the server, so the browser never assembles an official document.
- Voids are soft deletes with a mandatory reason, which keeps an audit trail.
None of this is specific to Next.js. The App Router just makes it easy to keep this code on the server, where it belongs. It's the approach we bring to custom software generally.
What does "done" mean on a larger build?
The retail POS keeps one status file, and it is the only document in the repository allowed to say a feature works. On 18 September 2026 its test suite passed 1,376 tests, and the status file still said plainly that none of the newest features had been used by a person at a counter. The integration pass found services that had been written but were never called, which is invisible to a test suite that only tests them in isolation.
It also found that local browser tests had been passing only because a git-ignored .env.local set a branch ID that didn't match the test data. CI failed the same tests four times. Two habits came out of that: CI is the source of truth, and "built" and "works" are different words.
What do we do by default now?
- Pages are Server Components.
'use client'goes on leaves. - No
ssr: falseon anything that takeschildren. generateStaticParams,dynamicParams = falseandgenerateMetadataon every content route.- The first screen paints without JavaScript.
- Browser-saved state only for badges and preferences, never for content.
- Exact versions for anything loaded at runtime.
curlevery template before calling a deploy done.
If you're planning a Next.js build, this is how our web development team works.
Sources
- Next.js docs, Lazy loading and Static exports
- Google Search Central, Managing multi-regional and multilingual sites
- web.dev, Largest Contentful Paint