So, for this section,
I prepared a brand new starting project,
which you, of course, find attached, and this project
actually consists of two projects, you could say.
It is a NextJS application,
and hence you should run npm install once
to install all dependencies
and then start the development server with npm run dev,
but this application actually also comes
with a separate backend again.
And you might often not need such a separate backend,
and we will also get rid of it later in this section,
but having that separate backend allows me to dive
into some of NextJS caching mechanisms in greater detail.
Therefore, in addition to starting that development server,
you should also navigate into that backend folder
and also run npm install there to install
all the dependencies required by that separate backend,
and then run npm start to start that backend server.
Now, that backend server is a very simple Node Express app
that just serves some dummy messages,
but I also do some logging there,
and that will help us understand when exactly NextJS
avoids requests due to caching and when it doesn't.
So, you should have both the backend
and the NextJS development server up and running,
and with that, you should then be able
to visit Localhost:3000,
see this page, navigate to the messages,
and see these messages here.
And with that, let's now explore when
and how exactly NextJS caches data and avoids requests.