Chapter 1 - Initialize the frontend project with Next.js¶
In this chapter, you will create a frontend project with the Next.js CLI.
You will then be able to start the application to see if it runs correctly.
Steps¶
Warning
Make sure to have your environment set up! You can check the Install and configure Visual Studio Code, Install and configure Docker and Install and configure Dev Containers tutorials if needed.
Create a Next.js project¶
In a terminal, execute the following command(s). | |
---|---|
You will be asked to install create-next-app@latest
, say Yes.
Then, you will be asked whether you want to use TailwindCSS and App Router. Reply No to the two questions.
Your working directory should look like this.
Start the Next.js application¶
The output of the command should look similar to this.
Check the results¶
You can now access your Next.js application on http://localhost:3000. You should see a welcoming page to Next.js 13 with links to the docs, tutorials, templates and deployment pf Next.js app.
To stop your Next.js application, press Ctrl+C in your terminal.
Summary¶
Congrats! You have a default Next.js application running! You are now able to create Next.js projects and start/stop Next.js applications.
Go further¶
Are you able to change the links from Templates
to Pimp My Wall
and redirect it to the BeeScreens Pimp My Wall application (https://pmw.beescreens.ch). Expand the next component to see the answer!
Show me the answer!
The entrypoint of the Next.js application is the index.tsx
file.
Its the page it loads then we access the root of the website /
. in this example, it's http://localhost:3000/
You can change the following code
to
frontend/src/index.tsx | |
---|---|
Save your changes. Next.js should automatically restart the application. Access http://localhost:3000, refresh the page and you should see the expected result.