npm package: @jemmyrehner1819/restaurant-management-system
Description: A complete restaurant inventory and sales management system with web interface
Author: Your Name
Latest version: 1.0.0

# Restaurant Management System

[![npm version](https://badge.fury.io/js/restaurant-management-system.svg)](https://badge.fury.io/js/restaurant-management-system)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A complete restaurant inventory and sales management system with a web-based interface. Manage ingredients, menu items, sales, and generate purchase orders automatically.

## Features

- 🥬 **Ingredient Management**: Track stock levels and set reorder points
- 🍕 **Menu Item Management**: Add items and update pricing
- 🔗 **Recipe Mapping**: Map ingredients to menu items with quantities
- 💰 **Sales Tracking**: Record sales and automatically deduct inventory
- 📋 **Purchase Orders**: Auto-generate orders for low-stock items
- 📊 **Reports**: Sales analytics and inventory reports
- 🌐 **Web Interface**: Easy-to-use HTML interface

## Prerequisites

- Node.js 14.0.0 or higher
- MySQL 5.7 or higher
- npm 6.0.0 or higher

## Quick Start

### Global Installation

```bash
# Install globally
npm install -g restaurant-management-system

# Setup the system
restaurant-setup

# Navigate to the created directory
cd restaurant-system

# Install dependencies
npm install

# Start the server
npm start
```

### Local Installation

```bash
# Install in your project
npm install restaurant-management-system

# Setup the system
npx restaurant-setup

# Navigate to the created directory
cd restaurant-system

# Install dependencies
npm install

# Start the server
npm start
```

## Database Setup

1. Make sure MySQL is running
2. Create the database and tables using the provided schema:

```bash
mysql -u root -p < schemas.sql
```

Or manually run the SQL commands from `schemas.sql` in your MySQL client.

## Configuration

Edit `config.json` to customize database connection and server settings:

```json
{
  "database": {
    "host": "localhost",
    "user": "root",
    "password": "your_password",
    "database": "restaurantDB"
  },
  "server": {
    "port": 3000
  }
}
```

## Usage

1. Start the server: `npm start`
2. Open your browser to `http://localhost:3000`
3. Use the navigation links to:
   - Add ingredients with stock levels
   - Add menu items with prices
   - Map ingredients to items (recipes)
   - Record sales transactions

## API Documentation

### Ingredients API

```javascript
// Add ingredient
POST /ingredients
{
  "name": "Tomatoes",
  "unit": "kg",
  "stock_quantity": 50,
  "reorder_level": 10
}

// Get all ingredients
GET /ingredients
```

### Items API

```javascript
// Add menu item
POST /items
{
  "name": "Margherita Pizza",
  "price": 12.99
}

// Update item price
PUT /items/:id
{
  "price": 13.99
}

// Get all items
GET /items
```

### Sales API

```javascript
// Record sale
POST /sales
{
  "item_id": 1,
  "quantity": 2
}

// Get sales history
GET /sales
```

## Programmatic Usage

You can also use this as a library in your Node.js applications:

```javascript
const RestaurantManagementSystem = require("restaurant-management-system");

// Initialize with custom config
const restaurant = new RestaurantManagementSystem({
  host: "localhost",
  user: "root",
  password: "mypassword",
  database: "myrestaurant",
  port: 4000,
});

// Start the server programmatically
restaurant.start();

// Or just copy files to a directory
await restaurant.copyFiles("./my-restaurant-app");
```

## File Structure

```
restaurant-system/
├── server.js          # Main server file
├── config.json        # Configuration
├── schemas.sql        # Database schema
├── package.json       # Dependencies
├── public/            # Web interface files
│   ├── index.html
│   ├── add-ingredient.html
│   ├── add-item.html
│   ├── map-ingredients.html
│   └── sales.html
└── README.md
```

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

If you encounter any issues or have questions, please [open an issue](https://github.com/yourusername/restaurant-management-system/issues) on GitHub.

## Changelog

### v1.0.0

- Initial release
- Full inventory management
- Sales tracking
- Web interface
- MySQL database integration