What is the purpose of the app directory in a Next.js 14 project?
The app directory holds the main application code using the new App Router. It organizes pages, layouts, and server components in a nested folder structure.
Click to reveal answer
beginner
What role does the public folder play in a Next.js project?
The <code>public</code> folder stores static files like images, icons, and fonts. These files are served directly at the root URL and do not require import statements.
Click to reveal answer
beginner
Why is the node_modules folder important in Next.js projects?
The node_modules folder contains all installed packages and dependencies needed for the project to run. It is managed automatically by the package manager.
Click to reveal answer
intermediate
What is the function of the next.config.js file?
The next.config.js file is used to customize and configure Next.js settings like routing, image optimization, and environment variables.
Click to reveal answer
beginner
How does the package.json file support a Next.js project?
The package.json file lists project metadata, scripts, and dependencies. It helps manage packages and defines commands like npm run dev to start the development server.
Click to reveal answer
Which folder in Next.js 14 contains the main app code using the App Router?
Apublic
Bpages
Capp
Dcomponents
✗ Incorrect
The app folder is the new main directory for routing and components in Next.js 14.
Where should you put images that need to be served directly without import in Next.js?
Apublic
Bcomponents/assets
Capp/images
Dstyles
✗ Incorrect
Static files like images go into the public folder to be served directly.
What file do you edit to change Next.js configuration settings?
Anext.config.js
Bpackage.json
Capp/layout.js
DREADME.md
✗ Incorrect
The next.config.js file is for customizing Next.js settings.
Which file lists the dependencies and scripts for a Next.js project?
Apublic/index.html
Bnext.config.js
Capp/page.js
Dpackage.json
✗ Incorrect
The package.json file manages dependencies and scripts.
What is the purpose of the node_modules folder?
ATo hold static images
BTo store installed packages and dependencies
CTo write page components
DTo configure environment variables
✗ Incorrect
The node_modules folder contains all installed packages needed for the project.
Describe the main folders and files you find in a Next.js 14 project and their purposes.
Think about where code, static files, and settings live.
You got /5 concepts.
Explain how the app directory differs from the old pages directory in Next.js.
Focus on routing and layout differences.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the app/ folder in a Next.js project?
easy
A. To organize pages, layouts, and API routes
B. To store static files like images and fonts
C. To hold configuration files like next.config.js
D. To keep test files and mocks
Solution
Step 1: Understand the role of app/ folder
The app/ folder is designed to organize the main parts of the app such as pages, layouts, and API routes.
Step 2: Compare with other folders
The public/ folder holds static files, and config files are outside app/. So, app/ is for app structure.
Final Answer:
To organize pages, layouts, and API routes -> Option A
Quick Check:
app/ folder = organize pages/layouts/API [OK]
Hint: Remember: app/ is your app's main structure folder [OK]
Common Mistakes:
Confusing app/ with public/
Thinking config files go inside app/
Assuming app/ holds only pages, ignoring layouts and APIs
2. Which folder should you place an image file in a Next.js project to serve it statically?
easy
A. app/
B. api/
C. components/
D. public/
Solution
Step 1: Identify static file storage
Static files like images should be placed in the public/ folder so they can be served directly.
Step 2: Exclude other folders
app/ is for pages/layouts, components/ is for React components, and api/ is for backend routes, so none are for static files.
Final Answer:
public/ -> Option D
Quick Check:
Static files = public/ folder [OK]
Hint: Static files go in public/ folder, not app/ [OK]
Common Mistakes:
Putting images inside app/ folder
Confusing components/ with static file storage
Trying to serve images from api/ folder
3. Given this Next.js project structure:
app/
layout.js
page.js
public/
logo.png
Which statement is true about accessing logo.png in the browser?
medium
A. You can access it at /logo.png
B. You must import it in page.js to use it
C. It is not accessible because it's inside public/
D. You can access it at /app/logo.png
Solution
Step 1: Understand public/ folder behavior
Files in public/ are served at the root URL path, so logo.png is accessible at /logo.png.
Step 2: Check other options
Importing is optional for static files; app/ folder files are not served as static assets, so /app/logo.png is invalid.
Final Answer:
You can access it at /logo.png -> Option A
Quick Check:
public/ files = root URL access [OK]
Hint: Static files in public/ map to root URL path [OK]
Common Mistakes:
Thinking you must import static files to access them
Trying to access static files via /app/ path
Assuming public/ files are not accessible
4. You see this error in your Next.js app: "Module not found: Can't resolve './logo.png'". Your project has logo.png inside public/. What is the likely cause?
medium
A. You placed logo.png inside app/ instead of public/
B. You tried to import logo.png from public/ using a relative path
C. The logo.png file is missing from public/
D. Next.js does not support PNG images
Solution
Step 1: Understand how to use files in public/
Files in public/ are accessed via URL paths, not imported with relative paths in code.
Step 2: Identify the error cause
Trying to import logo.png with a relative path causes "Module not found" error because public/ files are not part of the module system.
Final Answer:
You tried to import logo.png from public/ using a relative path -> Option B
Quick Check:
Importing public/ files = error [OK]
Hint: Don't import public/ files; use URL paths instead [OK]
Common Mistakes:
Importing static files from public/ folder
Assuming public/ files are part of module imports
Thinking Next.js can't serve PNG images
5. You want to create a new page with a custom layout in your Next.js app. Where should you place the layout and page files to follow the recommended project structure?
hard
A. Place both files inside components/ folder
B. Put layout.js in public/ and page.js in app/
C. Place both layout.js and page.js inside a new folder under app/
D. Put page.js in app/ and layout.js in api/
Solution
Step 1: Recall Next.js app folder structure
In Next.js, pages and their layouts are organized inside folders under app/ to group related files.
Step 2: Exclude incorrect placements
public/ is for static files, components/ is for reusable UI parts, and api/ is for backend routes, so these are not correct for layouts/pages.
Final Answer:
Place both layout.js and page.js inside a new folder under app/ -> Option C
Quick Check:
Layouts and pages live together under app/ [OK]
Hint: Keep layouts and pages together inside app/ folders [OK]
Common Mistakes:
Putting layouts in public/ or api/
Separating layout and page files into unrelated folders
Confusing components/ with page structure
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.