• English
  • Server & Build Stack

    Custom server

    Realm uses server.js for both dev and production — not next dev / next start.

    server.js loads .env.local, prepares the Next.js instance, creates the HTTP server, and listens on PORT (default 3000). See custom-server.

    proxy.ts is the Next.js middleware (Next.js 16 renamed middleware.ts to proxy.ts), handling locale routing and the GEO_COUNTRY cookie. See routes-and-proxy.

    Build commands

    pnpm dev        # node server.js (dev)
    pnpm build      # next build (outputs .next/)
    pnpm start      # cross-env NODE_ENV=production node server.js

    Vercel project settings

    SettingValue
    Framework PresetOther (do not use Next.js)
    Install Commandpnpm install
    Build Commandpnpm build
    Start Commandpnpm start
    Node.js24.x

    server.js does not run in Vercel deployments — Vercel uses serverless functions. The Framework Preset must be set to Other, or the build may fail.

    Other commands

    pnpm lint          # eslint .
    pnpm typecheck     # tsc --noEmit
    pnpm test          # vitest run
    pnpm check         # lint + typecheck + test + build
    pnpm env:sync      # scripts/sync-env-files.mjs

    See also