#Getting started

1 messages · Page 1 of 1 (latest)

scarlet flint
#

please give me a getting started guide

chilly compassBOT
#

Hi @scarlet flint. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To get started with Next.js, you can follow these steps:

  1. Install create-next-app: The easiest way to create a new Next.js application is by using create-next-app. This CLI tool sets up everything for you. To get started, run one of the following commands:
npx create-next-app@latest
# or
yarn create next-app
# or
pnpm create next-app

You will be asked a series of prompts to configure your project. Answer them accordingly, and a new project will be created with the correct configuration based on your answers.

  1. Manual Installation: If you prefer to manually create a new Next.js app, install the required packages:
npm install next@latest react@latest react-dom@latest

Then, open package.json and add the following scripts:

{
 "scripts": {
 "dev": "next dev",
 "build": "next build",
 "start": "next start",
 "lint": "next lint"
 }
}

These scripts correspond to different stages of developing an application:

  • dev: runs next dev to start Next.js in development mode.
  • build: runs next build to build the application for production usage.
  • start: runs next start to start a Next.js production server.
  • lint: runs next lint to set up Next.js' built-in ESLint configuration.
  1. TypeScript: If you want to set up a TypeScript project with Next.js, you can use the create-next-app command with the --example with-typescript flag:
npx create-next-app --example with-typescript my-stripe-project && cd my-stripe-project
# or
yarn create next-app --example with-typescript my-stripe-project && cd my-stripe-project

This will create a pre-configured Next.js TypeScript project.

For more information, refer to the following sources: