Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 04 / Topic 5 of 8

public/: the static-files folder

create-next-app already put five SVGs in harness/public/ back in Part 1 (next.svg, vercel.svg, and others), never used by any page this course built. This part adds Apna Bazaar's own asset instead: harness/public/apna-bazaar-vase.png, a small illustration standing in for a product photo. The installed package's own guide states the entire mechanism in one line: "Files inside public can then be referenced by your code starting from the base URL (/)." No route, no import required for this to be reachable — confirmed directly:

$ curl -s -D - -o /dev/null http://localhost:PORT/apna-bazaar-vase.png | grep -iE "^(HTTP|content-type|cache-control)"
HTTP/1.1 200 OK
Content-Type: image/png
Cache-Control: public, max-age=0

max-age=0 is worth noticing and remembering for later parts: unlike the hashed, content-addressed files Next.js builds into .next/static/ (immutable, cached for a year once a build exists), a plain file in public/ keeps the same URL forever (/apna-bazaar-vase.png never gets a content hash appended), so Next.js cannot safely tell a browser to cache it forever — replacing the file on disk would otherwise serve stale content at an unchanged URL.

Done here? The practice set for Part 4 — including the solutions — is on the part page.

Search the guide