Getting started with NextJS

Getting started with NextJS

Getting Started with Next.js 15

Next.js 15 is a powerful React framework that enables developers to build fast and user-friendly web applications. This guide will help you get started with Next.js 15.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js (version 14.0 or higher)
  • npm (version 6.0 or higher) or Yarn

Setting Up a New Next.js Project

  1. Create a new Next.js application:
    npx create-next-app@latest my-nextjs-app
    cd my-nextjs-app
    
  2. Start the development server:
    npm run dev
    
    Your application will be available at
    http://localhost:3000
    .

Project Structure with App Router

A typical Next.js project structure using App Router looks like this:
  • app/
    : Contains the application's pages. Each page.tsx correspond to a page.
  • public/
    : Static files like images.
  • layout file
    : Root layout that will appear on all your pages.
  • [slug]/
    : Folders with names with square brackets contains dynamic routes.

Creating Your First Page

  1. Create a new file
    about.js
    in the
    pages
    directory:
    // pages/about.js
    export default function About() {
        return <h1>About Page</h1>
    }
    
  2. Navigate to
    http://localhost:3000/about
    to see your new page.

Learn More

To learn more about Next.js 15, visit the official documentation.
Happy coding!