Building Admin Product Routes
Building Admin Product Routes
Welcome to the first lesson of the new course, Product Operations and Admin Workflows. Up to this point, the app has focused on customer-facing shopping and order flows: browsing products, checking out, reviewing orders, enriching order details, and finally managing order lifecycle actions like payment and cancellation. Now the project expands into internal tooling, which means you are no longer only building for shoppers — you are also building for administrators who need a structured workspace for managing the catalog.
In this lesson, you will create the first dedicated admin product route and connect it to a focused client page. You will also extend the shared navbar so the internal workspace is reachable from the shell, then build the initial admin product screen using the same collection-loading and page-state patterns the storefront already trusts. Finally, you will add page-local selection state so the admin view starts to feel like a real management workspace instead of only a read-only list.
Previously
In the previous unit, you finished the customer-side order experience by making the order detail page actionable. The app could already load orders and enrich line items, but the last lesson added lifecycle actions like Pay order and Cancel order, along with semantic API helpers, refresh-driven hooks, pending interaction state, and toast feedback. That work taught an important frontend lesson: good UI actions do not just trigger requests, they preserve trust by showing only valid actions, reflecting progress honestly, and re-reading canonical server state afterward.
This new course builds on that same architectural discipline, but in a different part of the app. Instead of shopper order pages, you are now starting an internal admin workflow. The same habits still matter: route files stay thin, hooks own async state, shared UI primitives keep layout consistent, and components should read clearly in terms of user intent rather than low-level mechanics.
Starting the Admin Route with a Thin Page File
The new route begins in src/app/admin/products/page.tsx. Just like other route files in this project, this file should not become a logic container. Its job is simply to activate the URL and hand rendering responsibility to a dedicated client component.
Here is the full route file:
-
The route imports
ProductAdminPageClientand immediately renders it, which keeps the file extremely easy to scan. This is a strong App Router pattern because route files remain declarative entry points instead of turning into large UI implementation files. -
Returning the client component directly also keeps routing concerns separate from interaction concerns. The route defines where the page lives, while the client component defines how the page behaves once it is active.
-
This mirrors patterns already used elsewhere in the codebase, which is important for maintainability. When all route files follow the same “thin handoff” structure, the project becomes easier to navigate because developers know exactly where to look for actual page behavior.
