Collecting workspace information# Restaurant Management API
A robust RESTful API built for restaurant order and table management. This system allows restaurant staff to manage tables, track orders, and process customer interactions efficiently.
- Product Management: Create, read, update, and delete menu items
- Table Management: Track available tables and their status
- Session Management: Open and close table sessions for customers
- Order Processing: Create and track orders with detailed information
- Order Summary: Calculate order totals and quantities per table session
- Node.js: JavaScript runtime
- Express: Web framework
- TypeScript: Type safety and enhanced developer experience
- Knex.js: SQL query builder
- SQLite: Lightweight database
- Zod: Robust schema validation
GET /products- List all products (with optional name filter)POST /products- Create a new productPUT /products/:id- Update an existing productDELETE /products/:id- Remove a product
GET /tables- List all tables
POST /tables-sessions- Open a new table sessionGET /tables-sessions- List all table sessionsPATCH /tables-sessions/:id- Close a table session
POST /orders- Create a new orderGET /orders/table-session/:table_session_id- Get all orders for a table sessionGET /orders/table-session/:table_session_id/total- Get order summary for a table session
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/batavoo/api-restaurant.git cd api-restaurant -
Install dependencies
npm install # or yarn -
Run migrations to setup the database
npm run knex migrate:latest
-
Seed the database with initial data
npm run knex seed:run
-
Start the development server
npm run dev
The application uses SQLite with the following tables:
- products: Menu items with prices
- tables: Restaurant tables
- tables_sessions: Track when tables are opened and closed
- orders: Store orders with product information, quantity, and pricing
Developed by Gustavo Santos Arruda