Help me design an optimal folder and routing structure for my material rental web application built with Next.js and TypeScript. I'm aiming for a clean, scalable, and maintainable codebase.
Details:
User Roles: The application has three distinct user roles: students, teachers, and administrators.
Activity Flows:
Admin: Manage Reservations
Admin logs in.
Admin navigates to "Manage Reservations" section.
Admin views a table of reservations (with details like product, student, dates).
Admin can filter/search reservations.
Admin can approve/reject individual reservations.
Admin: Manage Products
Admin logs in.
Admin navigates to "Manage Products" section.
Admin views a table of products.
Admin can add new products.
Admin can edit product details (name, description, availability).
Admin can delete products.
Student/Teacher: Reserve a Product
Student/teacher logs in.
Student/teacher browses the product catalogue.
Student/teacher selects a product, views product page.
Student/teacher clicks "Reserve".
Student/teacher selects a reservation date.
Student/teacher confirms the reservation.
Technology Stack:
Next.js (please specify if you're using the App Router or traditional file-based routing)
TypeScript
API Backend for data management
Key Questions:
Folder Structure: What's the most logical way to organize components, pages, layouts, and supporting files (e.g., for API interactions, styles, etc.)?
Routing: How should I map routes to components, considering nested routes and user-role-based restrictions?
Authentication/Authorization: What's the recommended approach to protect specific routes and implement access control based on user roles?
Best Practices: Are there specific Next.js patterns or techniques I should leverage for efficiency and maintainability?