Next.js Playground — Learn the App Router with 26 Interactive Lessons
A free, browser-based Next.js course, beginner to pro. Work through 26 lessons across 10 chapters — pages, layouts, components, hooks, route handlers, styling, dynamic routes, caching, metadata, and middleware — with live preview, progress tracking, and ZIP export. No install, no signup.
What's included
Features
app/globals.css, class names, and inline styles against the live previewpackage.json and next.config.mjsAbout this tool
Learn Next.js by Doing — Real App Router Code, Live in Your Browser
Spinning up a Next.js project just to try one idea is slow: install packages, start a dev server, create folders, wire up global CSS, add an API route. This Next.js playground removes that friction and turns the wait into a structured course. It is now a complete, interactive curriculum — 26 lessons across 10 chapters, beginner to pro — that runs real code in your browser, with nothing to install.
Every lesson executes for real. The playground transpiles your JSX with Babel and renders it through React 18 inside a sandboxed iframe, mounting your app/page.jsx inside app/layout.jsx exactly the way the App Router composes them. Edit any line and the live preview updates instantly. React hooks like useState and useEffect work, and route-handler lessons wire fetch('/api/hello') to your GET function so a page can call its own API — a real page-to-route workflow without a backend. A console panel captures log, warn, and error output, and a runtime error strip surfaces problems right next to the preview.
The 10 chapters move from first principles to production. App Router Basics covers how a page.jsx file becomes a route and how the default export renders the UI. Layouts shows shared and nested layouts via the children prop. Components & Props covers components, props, lists and keys, and conditional rendering. Client Components & State teaches 'use client', useState, events, controlled inputs, and useEffect. Route Handlers covers GET, dynamic JSON, and fetching in a component. Styling covers global CSS, class names, and inline styles. Data & Rendering Patterns covers loading states, error handling, and deriving UI from data. Navigation covers Link and in-page section nav. A Patterns & Project capstone ties it together with reusable components and a mini dashboard. Finally, Going to Production reaches pro level: dynamic routes ([slug] params), Server vs Client Components, loading & streaming, data fetching & caching (no-store, revalidate), the Metadata/SEO API, and middleware & deploying. Each lesson has a collapsible concept panel, a Quick Check question, and Mark Done progress tracking.
Why Use Next.js?
Next.js is the most widely adopted React framework for production apps, and these lessons put its biggest benefits into practice:
File-based routing. Folders inside app/ become routes automatically — no manual router configuration. Adding a page is as simple as adding a file.
Layouts and nested layouts. Shared UI like navbars and footers live in layout.jsx and persist across navigation without re-rendering, so pages stay focused on their own content.
Server and Client Components. Render on the server by default to ship less JavaScript and improve speed and SEO, and opt into client interactivity only where you need it with 'use client'.
Built-in route handlers. API endpoints live right beside your pages in route.js files, so you can build full-stack features in a single codebase instead of running a separate backend.
Rendering choices for speed and SEO. Next.js supports server-side rendering, static generation, and incremental static regeneration, chosen per page, so content is fast and search-engine friendly.
Built-in optimizations. Automatic code splitting, image and font optimization, route prefetching, and smart caching come out of the box — performance wins you would otherwise hand-build.
Built on React with great DX. Your component and hook skills carry straight over, with first-class TypeScript support, fast refresh, and conventions that keep large projects organized. It is production-proven at scale and deploys easily to Vercel or any Node host.
This playground is a learning and prototyping environment, not the full framework. It does not run the Next.js compiler, the Server Components runtime, middleware, the image optimizer, or the production build pipeline. When a lesson sparks a real project, click Export ZIP for a package.json and next.config.mjs scaffold and continue with npm install and npm run dev.
New to the layers underneath Next.js? Pair this course with the React Playground for hooks and component patterns, the JavaScript Playground for browser fundamentals, the CSS Playground for styling, and the Tailwind Playground for utility-first classes before configuring them in a real Next.js project.
Step by step
How to Use
- 1Pick a chapter and start the first lessonOpen the chapter-grouped lesson list and begin at App Router Basics. Each lesson loads working starter code into the editor so you can learn by editing instead of staring at a blank file. This is a natural next step after components in the React Playground.
- 2Read the concept, then edit the codeOpen the concept panel for a short explanation of the idea, then change
app/page.jsxand watch the live preview update. The page renders throughapp/layout.jsx, so you can see exactly how the App Router composes a route. - 3Style the result with globals.cssIn the Styling chapter, switch to
app/globals.cssto test typography, layout, buttons, and cards. The preview applies CSS immediately — a smooth move from basic CSS practice in the CSS Playground into a Next.js file structure. - 4Test a route handlerIn the Route Handlers chapter, edit the JSON returned from
GET()inapp/api/hello/route.js, then click GET /api/hello. A lesson page also fetches/api/hellowith useEffect so you can practice the page-to-route workflow. - 5Take the Quick Check and mark the lesson doneAnswer the multiple-choice Quick Check to confirm the concept, then use Mark Done to advance. The progress bar tracks how far through the 26 lessons you are, saved in your browser.
- 6Export when a prototype is worth keepingUse Export ZIP to get a small Next.js project with
package.jsonandnext.config.mjs, then runnpm installandnpm run devto continue locally. Move route handler ideas into real API testing with the REST API Builder.
Real-world uses
Common Use Cases
app/api/hello/route.js, run it from the API panel, and fetch it from a component with useEffect. A focused way to learn how App Router pages talk to their own API before moving to the REST API Builder.page.jsx, layout.jsx, globals.css, and route.js work together while the preview updates on the same screen.package.json and next.config.mjs, ready for npm install and npm run dev instead of loose copied snippets.Got questions?
Frequently Asked Questions
Next.js is the most widely adopted React framework for production web apps. It gives you file-based routing (folders become routes with no router config), shared and nested layouts, Server and Client Components that ship less JavaScript, built-in API route handlers for full-stack code in one project, and rendering choices (SSR, SSG, ISR) you pick per page for speed and SEO. You also get automatic code splitting, image and font optimization, prefetching, middleware on the edge, and a fast developer experience with TypeScript support. Because it is built on React, your component skills carry straight over. This playground teaches those benefits hands-on across 26 lessons, from your first page to dynamic routes, caching, metadata, and deployment.
Yes. This Next.js playground runs entirely in your browser. All 26 lessons transpile your JSX with Babel and render it through React inside a sandboxed iframe, so you can edit page.jsx, layout.jsx, globals.css, and a route handler and see a live result without installing Node.js, npm, or a dev server. It is built for learning and prototyping App Router patterns. When you want to build a real app, export the ZIP and run npm install plus npm run dev locally.
Some React helps but is not required. The early chapters cover JSX, expressions, components, props, lists, and conditional rendering, and the Client Components chapter teaches useState, events, controlled inputs, and useEffect. If you want a deeper React foundation first, work through the React Playground for hooks and component patterns, then return here to learn how Next.js adds routing, layouts, and route handlers around them.
There are 26 lessons across 10 chapters, beginner to pro: App Router Basics (pages, JSX, the default export as a route), Layouts (shared and nested layouts), Components & Props (components, props, lists and keys, conditional rendering), Client Components & State (use client, useState, events, controlled inputs, useEffect), Route Handlers (GET, dynamic JSON, fetching in a component), Styling (global CSS, class names, inline styles), Data & Rendering Patterns (loading states, error handling, deriving UI from data), Navigation (Link, in-page section nav), Patterns & Project (reusable components and a mini dashboard), and a Going to Production chapter (dynamic routes, Server vs Client Components, loading & streaming, data fetching & caching, the Metadata/SEO API, and middleware & deploying).
Yes. Every lesson executes for real in the browser. Edit any line of page.jsx and the live preview updates immediately, with the page mounted inside layout.jsx exactly as the App Router composes them. React hooks like useState and useEffect work, and route-handler lessons wire fetch("/api/hello") to your GET function so a page can call its own API. A console panel captures log, warning, and error output, and a runtime error strip surfaces problems near the preview.
No. The playground is a learning and prototyping environment, not the full framework. It does not run the Next.js compiler, the Server Components runtime, middleware, the image optimizer, or the production build pipeline. It focuses on the App Router files developers work with most — page, layout, CSS, and a route handler — so you can learn the model fast. Export the ZIP when you need real Next.js behavior.
Yes. The Route Handlers chapter includes app/api/hello/route.js and a panel that runs GET /api/hello inside the preview sandbox. You can edit the returned JSON, test Response.json output, and see how a page fetches that route with useEffect — a common App Router page-to-route workflow you can practice without a backend server.
Yes. Export ZIP creates a small Next.js project containing package.json, next.config.mjs, and the current app files. After downloading, unzip it, run npm install, then run npm run dev. The export turns a browser lesson or prototype into a normal local development workflow. Your progress and current files are also autosaved in your browser via localStorage and are never uploaded to a server.
The React Playground focuses on components, JSX, and hooks in a single-file editor. The Next.js Playground teaches how App Router files relate to each other — page.jsx, layout.jsx, globals.css, and route.js — plus routing, layouts, route handlers, and data patterns. Use the React Playground to master hooks and component patterns, then use this Next.js Playground to learn project structure and route-level behavior.