Day 1 — Build, Run & Fast Refresh
Foundations & build/Build, Run & Fast Refresh
Build & Test — Your Local Dev Loop
Your takeaway: Start the local development server, edit and save safely, and know when to use dev, build, or start.
You have found the important files. Now we need a way to see what those files produce. During development, Next.js runs a small web server on your own laptop and watches your code for saved changes.
Edit in VS Code
Save the file
See the browser update
Start the development server
1. Open a terminal inside your project folder
The terminal path should end with
my-profile-card.2. Run the project's development script
Terminal1npm run devnpmreads thedevscript inpackage.json. In a Next.js project, that startsnext dev(using Turbopack by default in Next.js 16).3. Open the Local address printed in the terminal
It is usually
http://localhost:3000. Use the exact address shown on your screen if Next.js chooses another port.
What does localhost mean?
localhost means “this computer.” The page is running on your laptop for testing; classmates cannot visit it over the public internet. Deployment comes later.Keep that terminal open
Save → Fast Refresh → updated page
The slides call this “hot reload.” In Next.js, the feature you will see is called Fast Refresh. Change JSX or styling in src/app/page.js, then save with Cmd + S on Mac or Ctrl + S on Windows. Most edits appear quickly without you pressing the browser refresh button.
Development loop
See edit → save → Fast Refresh → browser
When npm run dev is running, Next.js watches your project. Edit the heading and save it to see the same feedback loop you use while building.
- Edit
Change the JSX in page.js
- Save
Save the file in your editor
- Fast Refresh
The Next.js dev server processes the edit
- Browser
React renders the updated screen
Browser preview
Welcome to my profile
The browser and saved file match.
Fast Refresh usually preserves temporary state in function components, but some edits require a full reload or reset state. It is a development feature, not the production build.
Usually
Your edit updates in place
Sometimes
A full reload is needed
An error screen is feedback, not disaster
Development and production are different jobs
| Command | Job | Use it when… |
|---|---|---|
| npm run dev | Runs the development server | You are coding and want Fast Refresh and helpful errors |
| npm run build | Creates an optimised production build, then finishes | You want to check and prepare the app for production |
| npm run start | Serves a production build made by build | You are testing or hosting that completed production build |
None of these commands publishes the app to the internet by itself. For today's edit-and-check loop, stay with npm run dev.
Room check for 50 learnersShow noteHide note
Checkpoint — make one visible change
- Keep the development terminal running.
- Change one heading inside
src/app/page.js. - Save and point to the updated text in your browser.