Rebuilding vinceai.cn with Bun + Next.js 15: a modern fullstack walkthrough
Why we chose Bun workspaces, why we used the [locale] dynamic segment in App Router for i18n, the gotchas of deploying a monorepo on Vercel, and a few details that brought Lighthouse to 100.
vinceai.cn is the studio's own site. Since the client is ourselves, we treated the rebuild as a chance to run real engineering experiments. These notes capture the actual decisions and pitfalls — not generic advice — for anyone shipping a modern fullstack site.
Stack choices
Everything sits in a Bun workspaces monorepo:
- packages/web — the site itself, Next.js 15 App Router + Tailwind v4
- packages/server — contact-form intake API, Elysia + Drizzle
- packages/shared — brand constants, email templates, shared types
We chose Bun not because of speed, but because install / run / test / build all live in one toolchain — no more juggling npm/yarn/pnpm with ts-node/tsx. The tradeoff: Vercel deployment needs some setup (covered below).
i18n: dynamic [locale] segment, not middleware rewrites
Next.js docs now recommend route-segment-based i18n under App Router. We landed on the [locale] dynamic segment:
app/
├── layout.tsx // bare <html><body> shell
├── [locale]/
│ ├── layout.tsx // real layout with Nav / Footer
│ ├── page.tsx // /zh, /en
│ ├── about/page.tsx
│ └── ...
└── middleware.ts // just redirect + cookie writeUpside: every page is SSG, dictionary is read synchronously in server components — no client provider needed; each locale gets its own static output on Vercel.
Gotcha: the dictionary's TypeScript type must derive from zh.ts (typeof zh), with en.ts typed as Dictionary to enforce key parity. But if zh.ts uses `as const`, the type becomes literal — every string in en.ts then trips a TS2322 error. Drop the `as const`.
Two pitfalls deploying a Bun monorepo on Vercel
1) Don't bind the Vercel project to packages/web. Vercel defaults to npm install, which fails on workspace:* protocol:
npm error Unsupported URL Type "workspace:": workspace:*Correct setup: bind the project at the monorepo root so Vercel sees bun.lockb and auto-runs bun install.
2) Next.js cache. After moving app/ pages into app/[locale]/, .next/types/ kept stale references to old paths and broke the build. `rm -rf .next` and rebuild.
Animation: hover first, then add idle
We initially shipped a uiverse-style hover effect on CTAs (background flow, shine sweep, halo). Looked great on desktop — but mobile has no hover, so users only saw a static pill.
The fix is to split animation into two layers: idle uses CSS animation that runs continuously; hover uses transition to amplify. Everything respects prefers-reduced-motion and uses only transform / opacity / background-position / box-shadow / filter — fully compositor-only, no main-thread cost.
Lighthouse-100 details
- No Google Fonts — self-host with next/font/local; saves a DNS round-trip
- Use Next.js metadata routes for icon / OG image (app/icon.tsx, app/opengraph-image.tsx) to avoid CLS
- Always null-check querySelector inside useEffect — React 19 SSR will warn otherwise
- Tailwind v4's @utility is lighter than @layer components — wrap reusable class combos with @utility
Next up
The next post will cover the contact-form pipeline — Cloudflare Turnstile validation + Elysia route + Feishu webhook — and how to guarantee no email is lost without introducing a database.