Shawn Mervin

Next.js

A React framework I use when a site should be built ahead of time and served as plain files.

Visit nextjs.orgThe screen

What it is

Next.js is a React framework made by Vercel. It adds file-based routing, server rendering, static generation and a build pipeline on top of React, so a project starts with a working structure instead of one assembled by hand. Pages are just files in a folder, and the framework works out how each one should be built and served.

One of its options is a static export: every page is rendered at build time into HTML, CSS and JavaScript files. Those files can be served from any static host, with no Node server running in production. That makes it a good fit for content sites that change on a schedule rather than with every request.

How I use it

  • Built railandsailmh.ca for Rail & Sail Montessori House in Richmond: eight pages in Next.js 14 with React 18, TypeScript and Tailwind.
  • Exported the site to static files and served it from S3 through CloudFront, with DNS in Route 53.
  • Set it up in the school's own AWS account, so they own the site and the hosting outright.
  • Deploys are one command: sync to S3, then invalidate CloudFront.

Next.js fits when a site wants React components and a tidy page structure but has no need for a server at runtime. I reach for its static export so the client ends up with plain files on S3 and CloudFront: nothing to patch, no plugins and no database.

Questions

Does a Next.js site need a server?

Not always. With a static export every page is built ahead of time, so the site can be served from S3 and CloudFront with no server to run or patch. That is how the Rail & Sail site is hosted.

Who owns the hosting when you build a site?

For Rail & Sail, the school does. The site runs in their own AWS account, so there is no monthly subscription to me or anyone else.

Working with Next.js?

Tell me what you're building. Start a project or see the whole stack.

Got an operation that's outgrown its spreadsheets?

Tell me what your business does and where it's jamming up. If I'm not the right person for it, I'll say so and point you somewhere better.

What to send, and what happens next