Part 01 / Topic 7 of 9
Your first edit: three homepages, same file
Every example below replaces harness/app/page.tsx, gets curled against a running next dev, and leaves the harness in the state the next example (or the next part) finds it in.
Hello, Next.js (examples/01-hello-page.tsx) — the smallest possible page:
export default function Home() {
return (
<main>
<h1>Hello, Next.js</h1>
<p>This line came from app/page.tsx.</p>
</main>
);
}
$ curl -s http://localhost:3100/ | grep -o '<main>.*</main>'
<main><h1>Hello, Next.js</h1><p>This line came from app/page.tsx.</p></main>
Environment check (examples/02-env-check-page.tsx) — proves this function body runs on the server, where Node globals like process exist (the full reason why is Part 5's topic; for now, just notice it works, unlike in a plain client-side React component you fetch things into):
import packageJson from "../package.json";
export default function Home() {
return (
<main>
<h1>Environment check</h1>
<ul>
<li>Node.js: {process.version}</li>
<li>Platform: {process.platform}</li>
<li>next (from package.json): {packageJson.dependencies.next}</li>
</ul>
</main>
);
}
$ curl -s http://localhost:3100/ | grep -o '<main>.*</main>'
<main><h1>Environment check</h1><ul><li>Node.js: <!-- -->v22.23.2</li><li>Platform: <!-- -->darwin</li><li>next (from package.json): <!-- -->16.4.6</li></ul></main>
The <!-- --> comments are React's own hydration markers around text that was computed on the server — not a bug, not something you write yourself.
Welcome banner (examples/03-welcome-banner-page.tsx) — the file this course's harness actually keeps, so Part 2 starts from here:
export default function Home() {
return (
<main style={{ fontFamily: "system-ui", padding: "2rem", maxWidth: 560 }}>
<pre>
{`========================================
Welcome to Next.js Step by Step!
Learner: Priya, Bengaluru
========================================`}
</pre>
<p>Today's plan: create-next-app -> next dev -> next build</p>
<ul>
<li>Node.js: {process.version}</li>
<li>Rendered by: app/page.tsx</li>
</ul>
</main>
);
}
Rebuilding after this edit still prints ┌ ○ / — adding a banner did not add any per-request data, so it is still fully static.
Full files: examples/01-hello-page.tsx, examples/02-env-check-page.tsx, examples/03-welcome-banner-page.tsx.
Done here? The practice set for Part 1 — including the solutions — is on the part page.