DEV Community

Madhav Jha
Madhav Jha

Posted on

How to get started on latest NextJS

As of this writing, the docs are available here: https://beta.nextjs.org/docs/installation.

Setup:

You need Node v16.8.0 onwards. So using nvm make sure you are on a recent enough Node version.

One way to do this is to have a file called ~/.nvmrc with content (say) v16.13.0. Now anywhere in your shell you can do nvm use to switch to this "default" version.

With the prerequisites out of the way, you can create a new app with this command: npx create-next-app@latest --experimental-app.

In the new setup, you can see app/api/hello/route.ts. When you run npm run dev you can visit http://localhost:3000/api/hello to see this API route in action.

The app directory also contains layout.tsx and page.tsx. The latter functions as "index.tsx" file presumably.

Top comments (0)