This project is a full-stack application for a juice shop, consisting of a backend built with Ballerina and a frontend built with React.
For our project, we have decided to build a website for a juice bar. The purpose of the project was to enhance the efficiency of the juice bar's ordering and management process, ultimately saving time for the shop's customers. Through our website, we offer solutions to the problem of customers having to wait after placing their order. Also, our website makes work easier for the staff by reducing long queues and the rush during peak business hours.
-
Product Management:
- Get Product by ID: Retrieve product details by product ID.
- Add Product: Add new products to the inventory.
- Update Product: Update existing product details.
- Delete Product: Remove products from the inventory.
-
Order Management:
- Create Order: Place a new order.
- Get Orders by Customer ID: Retrieve all orders placed by a specific customer.
- Update Order Status: Change the status of an order (e.g., from "Processing" to "Shipped").
- Extend Order: Extend the delivery time of an order.
- Delete Order: Cancel an order.
-
User Management:
- User Signup: Register new users (customers and admins).
- User Login: Authenticate users and provide access based on user roles.
-
User Interface:
- Product Listing: Display a list of available products.
- Product Details: Show detailed information about a selected product.
- Order Summary: Display a summary of the user's current order.
- Order History: Show a list of past orders placed by the user.
-
User Actions:
- Place Order: Finalize and place an order.
- Extend Order: Extend the delivery time of an order.
- Cancel Order: Cancel an existing order.
-
Admin Actions:
- Manage Orders: View and update the status of orders.
The backend is built using Ballerina and handles the business logic and database interactions.
- Install Ballerina: Follow the instructions on the Ballerina website to install Ballerina.
- Database Setup: Import the
juice_shop.sqlfile into your MySQL database. - Configuration: Update the
Config.tomlfile with your database connection details. - Run the Backend:
cd backend ballerina run main.bal
- Get Product by ID:
GET /juiceBar/getProductbyID?Product_id={id} - Delete Order:
POST /juiceBar/deleteOrder?order_id={id} - Extend Order:
POST /juiceBar/extendOrder
The frontend is built using React and provides the user interface for the juice shop.
- Install Node.js: Follow the instructions on the Node.js website to install Node.js.
- Install Dependencies:
cd frontend npm install - Run the Frontend:
npm start
src/: Contains the source code for the frontend.public/: Contains the public assets likeindex.htmlandmanifest.json.
- Build:
cd backend ballerina build main.bal - Run Tests:
ballerina test
- Run Tests:
npm test - Build for Production:
npm run build