Interactive roadmap

    Next.js roadmap

    This roadmap is for developers who know React and want to build fast, modern web applications. You will learn routing, server components, and how to launch your projects.

    Your progress0% · 0 of 15 topics
    Done Learning Skipped OptionalClick any topic to learn more and mark your progress.
    1. 1

      React Refresher

      0 of 3 done

      Brush up on key React concepts before diving into Next.js.

      Take your time refreshing these core React concepts; a solid foundation makes learning Next.js much smoother.
    2. 2

      The App Router

      0 of 3 done

      Discover how Next.js handles file-based routing and page layouts.

      Let your folder structure do the heavy lifting for your URLs; simplicity is a key feature of the App Router.
    3. 3

      Server and Client Components

      0 of 3 done

      Learn when to run your code on the server versus the user's browser.

      Default to server components for speed and security, only switching to client components when you need browser interactivity.
    4. 4

      Data Fetching and Caching

      0 of 3 done

      Load information from databases and APIs smoothly.

      Fetch data directly inside your server components to simplify your code and skip setting up extra API endpoints.
    5. 5

      Auth and Deployment

      0 of 3 done

      Secure your application and share it with the world.

      Always store your secret API keys in environment variables and never commit them to public code repositories.

    Learn it all, with a tutor that never sleeps

    Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.

    Every topic explained

    Step 1: React Refresher

    Learn how to build reusable pieces of user interface and pass data between them.
    Read more

    Components are the building blocks of any modern web application. Think of them like Lego bricks that you can combine to create complex user interfaces.

    Props are simply custom inputs you pass into these components to change what they display, much like passing ingredients into a recipe. For instance, a single card component can display different product names and prices depending on the props it receives.

    Mastering components and props is essential because Next.js builds entirely upon this modular way of thinking.

    • Components are reusable UI building blocks
    • Props pass data down from parent to child
    • Keep components small and focused on one task
    React Documentation
    Understand how to manage changing data inside your components using built-in functions.
    Read more

    State represents data in your application that changes over time, such as whether a dropdown menu is open or closed. Hooks are special functions provided by React, like useState, that let you hook into this state inside your components.

    Imagine a shopping cart counter that increases every time you click buy. Without state, the number on the screen would never update.

    Understanding hooks is vital because Next.js relies heavily on modern React patterns for managing interactivity.

    • State handles changing data inside a component
    • The useState hook lets you track state easily
    • Updating state triggers a re-render of the UI
    (optional)
    Respond to clicks, typing, and other user actions in the browser.
    Read more

    Event handling allows your website to respond when a user interacts with the page, such as clicking a button or typing into a form.

    When a user types their email into a newsletter signup box, an event listener catches that action and triggers a function to handle the input. This makes your static web pages feel alive and interactive.

    Knowing how to handle events is important for capturing user input before sending it off to your Next.js server.

    • Listen for clicks, typing, and submissions
    • Attach functions to events using standard attributes
    • Prevent default browser actions when submitting forms

    Step 2: The App Router

    Create new pages and URLs simply by adding folders and files to your project.
    Read more

    File system routing means your website pages and URLs are created automatically based on the folders and files in your project. If you create a folder named contact with a page file inside, Next.js automatically makes that accessible at yourdomain.com/contact.

    This is like organizing documents in physical filing cabinets where the drawer label dictates where to find the file.

    It matters because it removes the need for complicated routing configuration files, saving you time.

    • Folders dictate your website URL paths
    • Special file names like page.js create the view
    • Nested folders create nested URL paths automatically
    Next.js Documentation
    Share common navigation bars and footers across multiple pages easily.
    Read more

    Layouts let you wrap multiple pages in shared UI elements like navigation bars and footers without repeating code. When you navigate between pages, the layout stays put while only the main content changes.

    Think of it like a magazine template where the header and page numbers remain fixed while the articles change on every leaf.

    This is crucial for building cohesive web applications with consistent navigation and great performance.

    • Layouts wrap around child pages automatically
    • Shared elements persist during page navigation
    • Nested layouts allow section-specific navigation
    (optional)
    Show helpful messages or spinners when pages take time to load or break.
    Read more

    Loading and error states help keep your users informed when something takes time to fetch or when an unexpected bug occurs. Instead of a blank screen, you can show a friendly spinner or a fallback message.

    Imagine an ATM showing a please wait screen while counting your cash, or a polite apology note if the machine jams.

    Adding these states makes your application feel robust, reliable, and professional.

    • Show fallback spinners during data loading
    • Catch unexpected errors with dedicated error files
    • Improve user experience during slow network speeds

    Step 3: Server and Client Components

    Run code on the server to keep your final website bundle small and secure.
    Read more

    Server components run exclusively on the server, generating the HTML before sending it to the user's browser. This keeps heavy JavaScript code off the user's device and protects sensitive database secrets.

    Think of it like a restaurant kitchen preparing your meal out of sight so you only receive the finished plate at your table.

    They matter because they make your websites load significantly faster on mobile phones and low-powered devices.

    • Rendered entirely on the server
    • Keeps heavy dependencies out of the browser bundle
    • Ideal for fetching data securely from databases
    Use the client directive when you need browser features like state and event listeners.
    Read more

    Client components are standard React components that run in the user's web browser. You opt into them by adding a simple directive at the very top of your file.

    Imagine a digital calculator app where every button press must be calculated instantly right on your phone screen.

    You need client components whenever you require browser features like state, event listeners, or browser storage.

    • Use the use client directive at the top
    • Required for state and browser event listeners
    • Sent to the browser and run by the user
    (optional)
    Combine server and client components effectively without hurting performance.
    Read more

    Composition patterns teach you how to nest client components inside server components without losing the performance benefits of server-side rendering.

    Think of it like buying a powerful server computer that builds most of a house, but leaves one interactive smart thermostat plugged into the wall.

    Getting this mix right ensures your app remains fast while still supporting rich user interactions.

    • Pass server components as children to client components
    • Keep as much code on the server as possible
    • Isolate interactivity only where strictly needed

    Step 4: Data Fetching and Caching

    Load information directly inside your server components using standard JavaScript.
    Read more

    Fetching data on the server lets your components grab information directly from databases or external APIs before the page even reaches the browser. You can use standard JavaScript async and await syntax right inside your components.

    Imagine a news website printing the morning paper with today's headlines already baked into the ink before it lands on your doorstep.

    This matters because it hides your API keys and speeds up initial page loads.

    • Use async and await inside server components
    • Connect directly to databases or APIs
    • No extra client-side loading spinners needed for basic data
    Speed up your site by saving fetched data and updating it when needed.
    Read more

    Caching saves the results of your data fetches so your website does not repeatedly ask the database for the exact same information. Revalidation tells Next.js when it is time to refresh that saved data.

    Think of a grocery store keeping popular items stocked on the front shelf, but checking with the main warehouse every hour for new stock.

    This makes your application lightning fast while ensuring your content does not grow stale.

    • Next.js caches fetched data by default
    • Revalidate data on a schedule or on-demand
    • Balance speedy page loads with fresh content
    (optional)
    Send user input back to the server securely without writing complex API endpoints.
    Read more

    Server actions let you run asynchronous functions directly on the server, triggered by form submissions or user interactions in your components. You can handle database updates without writing separate API routes.

    Imagine dropping a comment card into a suggestion box; the venue handles it behind the scenes without you needing to call their office.

    They streamline form handling and keep your code clean and secure.

    • Write server-side functions called directly from UI forms
    • Eliminate boilerplate API endpoint code
    • Securely handle form submissions and database writes

    Step 5: Auth and Deployment

    Allow users to log in securely using passwords or third-party providers.
    Read more

    Authentication verifies who your users are, allowing them to sign up, log in, and protect private pages like a user dashboard. Libraries and providers make this easier by handling secure password hashing and login tokens.

    Think of showing your passport to check into a hotel room, proving your identity before entering your private suite.

    Setting this up correctly is crucial for protecting user data and building secure web apps.

    • Verify user identities safely
    • Protect private routes from logged-out visitors
    • Use established auth providers to avoid security risks
    Keep secret keys and database passwords hidden safely.
    Read more

    Environment variables are secret configuration values, like database passwords and API keys, stored safely outside your main codebase.

    Think of them like the combination code to a secure office safe kept separate from the office floor plan.

    Using environment variables prevents you from accidentally leaking sensitive credentials when sharing your code publicly online.

    • Store secrets in local environment files
    • Prefix public variables correctly for browser access
    • Never expose private database keys in client code
    (optional)
    Publish your finished website online so anyone can visit it.
    Read more

    Deploying means publishing your finished Next.js application to a cloud hosting platform so anyone around the world can access it via a public URL.

    Think of it like opening the doors of your new shop to the public after finishing all the interior decorating.

    This is the final step that brings all your hard work together into a live, working product.

    • Connect your code repository to a hosting platform
    • Configure environment variables in your hosting dashboard
    • Automatic builds publish your site updates live

    Related roadmaps