A landing page has one job: turn a visitor into a signup. In this guide we'll build the foundations of a fast, good-looking SaaS landing page with Next.js 16 (App Router) and Tailwind CSS 4, using four patterns that save hours on every project:

  1. Keep all content in one config file
  2. Drive colors from CSS variable theme tokens
  3. Add dark mode without the flash
  4. Ship SEO and structured data by default

Let's go.

1. Set up the project

npx create-next-app@latest my-landing --ts --tailwind --app --src-dir cd my-landing npm run dev 

Next.js 16 uses the App Router and Turbopack by default, and Tailwind CSS 4 is configured with a single @import "tailwindcss"; line in globals.css. No tailwind.config.js is needed.

2. Put every word in one config file

The biggest time sink on landing pages is hunting for text across a dozen components. Instead, keep all copy in one typed object:

// src/config/site.ts export const site = { name: "Driftly", tagline: "Product analytics that answers questions, not just charts.", url: "https://driftly.example.com", }; export const hero = { title: { before: "Know why users stay.", highlight: "Ship what they need." }, subtitle: "Driftly connects to your product in five minutes and tells you what is working.", primaryCta: { label: "Start free trial", href: "#get-started" }, }; export const faq = { items: [ { q: "How long does setup take?", a: "Most teams send their first events within five minutes." }, { q: "Can I cancel anytime?", a: "Yes. Plans are month-to-month with no lock-in." }, ], }; 

Components just import what they need:

import { hero } from "@/config/site"; export function Hero() { return ( <section className="py-24 text-center"> <h1 className="text-5xl font-semibold tracking-tight text-balance"> {hero.title.before} <span className="text-brand">{hero.title.highlight}</span> </h1> <p className="mx-auto mt-6 max-w-2xl text-lg text-muted">{hero.subtitle}</p> <a href={hero.primaryCta.href} className="mt-8 inline-flex rounded-full bg-brand px-6 py-3 text-brand-fg"> {hero.primaryCta.label} </a> </section> ); } 

Now rewriting your page, or reusing the template for a new product, means editing one file.

3. Theme tokens: change your brand color in one place

Tailwind CSS 4 lets you map CSS variables straight into utility classes with @theme inline. Define your palette once for light mode and once for dark mode:

/* src/app/globals.css */ @import "tailwindcss"; @custom-variant dark (&:where(.dark, .dark *)); :root { --bg: #ffffff; --fg: #0b1020; --muted: #5b6478; --brand: #5b5bf6; --brand-fg: #ffffff; } .dark { --bg: #07090f; --fg: #eef1f8; --muted: #98a1b6; --brand: #7c7cff; --brand-fg: #0b0b1a; } @theme inline { --color-bg: var(--bg); --color-fg: var(--fg); --color-muted: var(--muted); --color-brand: var(--brand); --color-brand-fg: var(--brand-fg); } 

Now bg-brand, text-muted and bg-bg work everywhere, and they switch automatically in dark mode. Rebranding is a two-line change.

4. Dark mode without the flash

If you read the user's theme in a React effect, the page renders light first and then flips to dark. Users see a white flash. The fix is a tiny inline script that runs before the first paint:

// src/app/layout.tsx const themeScript = `(function(){try{ var t = localStorage.getItem('theme'); var d = t ? t === 'dark' : matchMedia('(prefers-color-scheme: dark)').matches; document.documentElement.classList.toggle('dark', d); }catch(e){}})();`; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en" suppressHydrationWarning> <head> <script dangerouslySetInnerHTML={ { __html: themeScript } } /> </head> <body>{children}</body> </html> ); } 

The toggle button only needs to flip the class and save the choice:

"use client"; export function ThemeToggle() { return ( <button aria-label="Toggle dark mode" onClick={() => { const dark = document.documentElement.classList.toggle("dark"); try { localStorage.setItem("theme", dark ? "dark" : "light"); } catch {} }} > 🌓 </button> ); } 

suppressHydrationWarning on <html> stops React from complaining that the server-rendered class differs from the client.

5. A FAQ accordion with zero JavaScript

You don't need a component library for an accordion. Native <details> is accessible and keyboard-friendly out of the box:

{faq.items.map((item) => ( <details key={item.q} className="group border-b border-border py-5"> <summary className="flex cursor-pointer justify-between font-medium"> {item.q} <span className="transition-transform group-open:rotate-45">+</span> </summary> <p className="mt-3 text-muted">{item.a}</p> </details> ))} 

Add details > summary { list-style: none; } to your CSS to hide the default marker.

6. SEO and structured data by default

The App Router gives you metadata, sitemaps and social images as plain files.

Metadata from your config:

export const metadata: Metadata = { metadataBase: new URL(site.url), title: `${site.name} — ${site.tagline}`, description: site.description, openGraph: { type: "website", url: site.url, siteName: site.name }, twitter: { card: "summary_large_image" }, }; 

Sitemap in src/app/sitemap.ts:

import type { MetadataRoute } from "next"; import { site } from "@/config/site"; export default function sitemap(): MetadataRoute.Sitemap { return [{ url: site.url, changeFrequency: "weekly", priority: 1 }]; } 

FAQ structured data so Google can show your answers in search results:

const faqJsonLd = { "@context": "https://schema.org", "@type": "FAQPage", mainEntity: faq.items.map((i) => ({ "@type": "Question", name: i.q, acceptedAnswer: { "@type": "Answer", text: i.a }, })), }; <script type="application/ld+json" dangerouslySetInnerHTML={ { __html: JSON.stringify(faqJsonLd) } } /> 

Finally, add src/app/opengraph-image.tsx with ImageResponse from next/og to generate a 1200×630 social preview from your site name and tagline. Every shared link then gets a proper card.

7. One gotcha in Next.js 16: new Date() in server components

If you enable cacheComponents in next.config.ts (it gives you fast, pre-rendered pages), this innocent footer line breaks the build:

<p>© {new Date().getFullYear()} Driftly</p> 

Next.js refuses values that change on every request during prerendering. Wrap the value in a cached function instead:

async function getYear() { "use cache"; return new Date().getFullYear(); } export async function Year() { return <>{await getYear()}</>; } 

Wrapping up

With one config file, theme tokens, a no-flash dark mode and SEO baked in, you have a landing page foundation you can reuse for every product you launch.

If you'd rather not build all of this from scratch:

Happy shipping! 🚀