Organizing the folder structure
As we've already seen, Next.js forces you to place some files and folders in particular locations of your code base (think of
_documents.js files, the
public/ directories, and so on), but it also provides a way to customize their placement inside your project repository.
We've already seen that, but let's do a quick recap on a default Next.js folder structure:
next-js-app - node_modules/ - package.json - pages/ - public/ - styles/
Reading from top to bottom, when we create a new Next.js app using
create-next-app, we get the following folders:
node_modules/: The default folder for Node.js project dependencies
pages/: The directory where we place our pages and build the routing...