Explain the role of the public directory in a Next.js application.
Instruction: Describe the purpose and use of the public directory in Next.js.
Context: This question tests the candidate's knowledge of the file structure and static file handling in Next.js.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
The public directory holds files that should be served directly at root-relative URLs. For example, public/logo.png is available as /logo.png, and public/downloads/guide.pdf is available as /downloads/guide.pdf. The public directory name is not part of those URLs.
This is useful for fixed images, downloadable public documents and other assets that do not need an application handler...