A robust REST API backend system for restaurant management built with Go, Gin framework, and MongoDB. This system handles various aspects of restaurant operations including user management, food items, menu management, order processing, and invoicing.
- User Authentication & Authorization
- Table Management
- Menu Management
- Food Items Management
- Order Processing
- Order Items Tracking
- Invoice Generation
- Middleware for Authentication
- Go - Primary programming language
- Gin - Web framework
- MongoDB - Database
- JWT - Authentication
Before running this project, make sure you have the following installed:
- Go (1.16 or later)
- MongoDB
- Git
go-restro-backend/
├── controllers/
├── database/
├── helpers/
├── middleware/
├── models/
├── routes/
├── main.go
└── README.md
- User
- Table
- Order
- OrderItem
- Menu
- Food
- Invoice
- Note
GET /users
- Get all usersGET /users/:user_id
- Get specific userPOST /users/signup
- Register new userPOST /users/login
- User login
GET /tables
- Get all tablesGET /tables/:table_id
- Get specific tablePOST /tables
- Create new tablePATCH /tables/:table_id
- Update table
GET /foods
- Get all food itemsGET /foods/:food_id
- Get specific food itemPOST /foods
- Add new food itemPATCH /foods/:food_id
- Update food item
GET /menus
- Get all menusGET /menus/:menu_id
- Get specific menuPOST /menus
- Create new menuPATCH /menus/:menu_id
- Update menu
GET /orders
- Get all ordersGET /orders/:order_id
- Get specific orderPOST /orders
- Create new orderPATCH /orders/:order_id
- Update order
GET /orderItems
- Get all order itemsGET /orderItems/:orderItem_id
- Get specific order itemGET /orderItems-order/:order_id
- Get items by orderPOST /orderItems
- Create order itemsPATCH /orderItems/:orderItem_id
- Update order items
GET /invoices
- Get all invoicesGET /invoices/:invoice_id
- Get specific invoicePOST /invoices
- Create new invoicePATCH /invoices/:invoice_id
- Update invoice
- Clone the repository
git clone https://github.com/yourusername/go-restro-backend.git
- Navigate to the project directory
cd go-restro-backend
- Install dependencies
go mod download
- Set up environment variables
export PORT=8080
export SECRET_KEY=your-secret-key
- Run the application
go run main.go
The server will start running at http://localhost:8080
Create a .env
file in the root directory and add the following:
PORT=8080
MONGODB_URL=your_mongodb_connection_string
SECRET_KEY=your_jwt_secret_key
The API uses JWT (JSON Web Tokens) for authentication. Protected routes require a valid JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.