liveBook · Manning

File-system based routing

As explained in Build Financial Software with Generative AI (From Scratch)

File-based routing is a routing technique in which filesystem paths and files determine application URL routes.

File-system-based routing turns a project’s folder and file structure into application URL routes. In a Next.js dashboard, this reduces routing configuration while supporting nested pages, multiple layouts, and error handling. section 6.1

The approach fits a dashboard that lets users upload files and review associated data. A page can link each uploaded filename to a details route, so the URL identifies which file the user selected. section 6.6.2 section 6.9

Dynamic file details route

Create src/app/fileDetails/[id]/page.tsx. The [id] directory declares a dynamic URL parameter, allowing routes such as /fileDetails/0854b018-c5ce-4e00-8a4f-d268a1a85aa2. A filename link can navigate to /fileDetails/${row.id}, passing the selected file’s UUID to the details page. section 6.6.2

Listing 6.31 Updated RecentAchUploads
<TableCell>
   <Link onClick={() =>                      #1
      route.push(`/fileDetails/${row.id}`)}>  #1
         {row.filename}                       #1
   </Link>
</TableCell>

Shows the dashboard link that constructs a file-details URL from each uploaded row’s identifier. section 6.6.2

Listing 6.32 Folder structure for the file details page
src/
├─ app/
│  ├─ fileDetails/
│  │  ├─ [id]/          #1
│  │  │  ├─ page.tsx

Shows the app-directory structure that makes the file-details route and its dynamic parameter discoverable from the filesystem. section 6.6.2

How Build Financial Software with Generative AI (From Scratch) covers it

How deep it goes
Demonstrates folder and link implementation, while deferring broader routing behavior beyond nested routes, layouts, and error handling.
Examples
Uses an app-directory route, a bracketed id folder, UUID-based URLs, and clickable uploaded filenames.
What it assumes
Assumes a Next.js project and basic familiarity with application folders, links, and record identifiers.
What you can do after
Build it by creating a route folder, adding a page file, and linking records to URLs containing their identifiers.
How it connects
Connects dynamic parameters with nested routing, layouts, error handling, and dashboard navigation.

Also explained in

Compare how 2 books explain file-system based routing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Financial Software with Generative AI (From Scratch). The section links point to the parts of the book it draws on.