Skip to content

Modern, full-featured Point of Sales (POS) and Restaurant Management System built with Next.js, TypeScript, and MySQL.

Notifications You must be signed in to change notification settings

AlpianPPLG/Restaus

Repository files navigation

🍽️ RESTAUS - Restaurant Management System

Modern, full-featured Point of Sales (POS) and Restaurant Management System built with Next.js, TypeScript, and MySQL.

RESTAUS Banner

✨ Features

πŸ” Multi-Role Authentication

  • Admin: Full system access, menu management, reports, and analytics
  • Waiter: Table management, order creation, customer service
  • Kitchen: Order queue display, cooking workflow management
  • Cashier: Payment processing, receipt generation

πŸ“Š Core Functionality

  • Real-time Table Status: Live updates of table availability and occupancy
  • Smart Order Management: From order creation to delivery tracking
  • Kitchen Display System (KDS): Efficient order queue for kitchen staff
  • Payment Processing: Cash payment with automatic change calculation
  • Warning System: Automatic alerts for pending payments
  • Inventory Management: Daily stock tracking and availability
  • Receipt Generation: Professional receipt printing

🎨 Modern UI/UX

  • Responsive Design: Works on desktop, tablet, and mobile
  • Dark Mode: Eye-friendly theme switching
  • Real-time Updates: Automatic polling for live data
  • Premium Aesthetics: Modern gradients, animations, and micro-interactions
  • Shadcn UI Components: Beautiful, accessible component library

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 14+ (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: Shadcn UI
  • Icons: Lucide React
  • State Management: TanStack Query (React Query)
  • Forms: React Hook Form + Zod
  • Notifications: Sonner
  • Theme: next-themes

Backend

  • Runtime: Node.js
  • API: Next.js API Routes
  • Database: MySQL
  • ORM: mysql2 (with connection pooling)
  • Validation: Zod

πŸ“ Project Structure

restaus-app/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ api/                  # API Routes
β”‚   β”‚   β”œβ”€β”€ auth/            # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ tables/          # Table management
β”‚   β”‚   β”œβ”€β”€ menus/           # Menu management
β”‚   β”‚   β”œβ”€β”€ orders/          # Order management
β”‚   β”‚   β”œβ”€β”€ payments/        # Payment processing
β”‚   β”‚   └── categories/      # Category endpoints
β”‚   β”œβ”€β”€ login/               # Login page
β”‚   β”œβ”€β”€ admin/               # Admin dashboard
β”‚   β”œβ”€β”€ waiter/              # Waiter interface
β”‚   β”œβ”€β”€ kitchen/             # Kitchen display
β”‚   └── cashier/             # Cashier interface
β”œβ”€β”€ components/              # React components
β”‚   β”œβ”€β”€ ui/                  # Shadcn UI components
β”‚   └── providers/           # Context providers
β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”œβ”€β”€ use-auth.ts         # Authentication hook
β”‚   β”œβ”€β”€ use-tables.ts       # Tables data hook
β”‚   β”œβ”€β”€ use-menus.ts        # Menus data hook
β”‚   β”œβ”€β”€ use-orders.ts       # Orders data hook
β”‚   β”œβ”€β”€ use-cart.ts         # Shopping cart hook
β”‚   └── use-payments.ts     # Payments hook
β”œβ”€β”€ lib/                     # Utility libraries
β”‚   β”œβ”€β”€ db.ts               # Database connection
β”‚   β”œβ”€β”€ api-client.ts       # API client utilities
β”‚   β”œβ”€β”€ api-response.ts     # API response helpers
β”‚   └── utils.ts            # General utilities
β”œβ”€β”€ types/                   # TypeScript type definitions
β”‚   └── index.ts            # All type definitions
β”œβ”€β”€ constants/               # Application constants
β”‚   └── index.ts            # Constants and configs
β”œβ”€β”€ sql/                     # SQL scripts
β”‚   β”œβ”€β”€ query.sql           # Database schema
β”‚   └── seed.sql            # Seed data
β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ plan.md             # Project plan
β”‚   β”œβ”€β”€ major-task.md       # Major tasks
β”‚   β”œβ”€β”€ minor-task.md       # Minor tasks
β”‚   └── PROGRESS.md         # Implementation progress
└── middleware.ts            # Next.js middleware

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ installed
  • MySQL 8+ installed and running
  • npm or yarn package manager

Installation

  1. Clone the repository

    git clone <repository-url>
    cd restaus-app
  2. Install dependencies

    npm install
  3. Setup Database

    # Create database
    mysql -u root -p < sql/query.sql
    
    # Insert seed data
    mysql -u root -p < sql/seed.sql
  4. Configure Environment Variables Create a .env.local file in the root directory:

    DB_HOST=localhost
    DB_USER=root
    DB_PASSWORD=your_password
    DB_NAME=restaus_db
    NEXT_PUBLIC_API_URL=http://localhost:3000/api
  5. Run Development Server

    npm run dev
  6. Open Application Navigate to http://localhost:3000

πŸ‘€ Demo Credentials

Role Username Password
Admin admin admin123
Waiter waiter waiter123
Kitchen kitchen kitchen123
Cashier cashier cashier123

πŸ“– Usage Guide

For Waiters

  1. Login with waiter credentials
  2. View table dashboard with real-time status
  3. Click available table to start new order
  4. Select menu items and add to cart
  5. Add special notes if needed
  6. Submit order to kitchen

For Kitchen Staff

  1. Login with kitchen credentials
  2. View incoming orders in queue
  3. Update item status: Pending β†’ Cooking β†’ Served
  4. Orders automatically move to cashier when all items served

For Cashiers

  1. Login with cashier credentials
  2. View tables with delivered orders
  3. Process payment (cash)
  4. System calculates change automatically
  5. Print receipt

For Admins

  1. Login with admin credentials
  2. Manage menus and categories
  3. Update daily inventory
  4. View sales reports and analytics
  5. Manage tables and users

πŸ”„ Business Flow

1. Restaurant Opens β†’ All tables set to "Available"
2. Customer Arrives β†’ Waiter assigns table (Reserved)
3. Order Placed β†’ Items sent to kitchen (Processing)
4. Cooking β†’ Kitchen updates item status (Cooking)
5. Ready β†’ All items marked as served (Delivered)
6. Warning β†’ System alerts if payment pending > 5 min
7. Payment β†’ Cashier processes payment (Completed)
8. Table Released β†’ Status returns to "Available"

🎯 Key Features in Detail

Real-time Updates

  • Tables auto-refresh every 5 seconds
  • Kitchen queue updates every 3 seconds
  • Warning checks every 10 seconds

Inventory Management

  • Daily stock tracking
  • Automatic stock reduction on order
  • Out-of-stock items automatically disabled

Warning System

  • Alerts when order delivered but not paid
  • Visual indicators on table dashboard
  • Prioritizes tables needing payment

πŸ“ API Documentation

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout

Tables

  • GET /api/tables - Get all tables
  • POST /api/tables - Create table
  • GET /api/tables/[id] - Get single table
  • PATCH /api/tables/[id] - Update table status
  • DELETE /api/tables/[id] - Delete table

Orders

  • GET /api/orders - Get all orders (with filters)
  • POST /api/orders - Create new order
  • GET /api/orders/[id] - Get single order
  • PATCH /api/orders/[id]/status - Update order status

Payments

  • POST /api/payments - Process payment
  • GET /api/payments - Get payment history

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License.

πŸ‘¨β€πŸ’» Author

Built with ❀️ for modern restaurant management

πŸ™ Acknowledgments

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

Modern, full-featured Point of Sales (POS) and Restaurant Management System built with Next.js, TypeScript, and MySQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published