How auntapza/restaurant-reservation-systems works
Main Components
• Next.js Application Layer – Represent the core framework that powers both the server-side and client-side rendering.
• Role-Based Interfaces:
• Admin Interface: Found under src/app/admin, covering account management, food item management (add, edit), and related layout components.
• Worker Interfaces: Located inside src/app/(worker) with further categorized folders for different worker roles (cashier, chef, waiter). For example, the cashier section even has a checkout sub-path with dynamic routes ([tableid] pages).
• Customer (App) Interface: Under src/app/app with pages for food display (FoodList, FoodPopup), cart operations, payment, receipt (recipt) and summary (summery), and table management.
• Authentication Components: Login and Register pages (located in src/app/login and src/app/register) which are critical for user session management.
• Shared Components & Utilities:
• Reusable UI components are under src/component (such as Navbar, Menubar, Button, Footer, etc.).
• Utility libraries and functions are in src/function (API calls, cart management, encoding, etc.) and state hooks in src/hooks.
• A global socket connection is set up via src/lib/socket.ts to potentially enable real-time interactions.
• Static & Global Configurations: Configuration files (next.config.ts, tailwind.config.ts, tsconfig.json, ESLint config) and global CSS styles show how styling and project-wide rules are enforced.
• Middleware: The presence of middleware.ts hints at request/response processing layers.
Component Interactions
• Browser/Client: All users (admin, staff, customers) interact via their web browsers.
• Next.js Server & Routing: The server uses the file system routing (as seen from the nested directories) to direct the flow of requests to the appropriate UI pages.
• Role-Specific Workflows:
• For example, the cashier workflow involves a checkout process (dynamic route using [tableid]) and popup specifics, which would be a subcomponent of the cashier interface.
• Similarly, waiter pages have a grouping that includes table selection and dynamic table routing.
• API & Utility Functions: Place a node that represents shared business logic and API calls (from src/function/api.ts, etc.) which support data fetching and communication between the UI and backend processes.
• Real-Time Communication: A socket node (from src/lib/socket.ts) intended to facilitate real-time updates (order status, notifications, etc.), influencing multiple roles simultaneously.
Architectural Decisions & Patterns
• Folder Separation by Role: Using Next.js’s “app” directory grouping (such as (worker), admin, app) clearly reflects the use of a Modular or Domain-Driven Design.
• Use of Dynamic Routing: The file tree shows dynamic segment usage (e.g., [tableid], [id]) which is vital for representing data-specific pages, so include dynamic linkages between URL parameters and the component rendering.
• Shared Design Principles: Emphasize separation of presentation (UI components in src/component) and business logic (in src/function, src/hooks), along with centralized configuration management.
• Third-Party Integrations/Frameworks: The project uses Next.js features, CSS through Tailwind (via tailwind.config.ts), and automatically optimized fonts (using next/font).