A checkout system with pricing rules and special offers, built with React (Frontend) and Java Spring Boot (Backend).
- ✅ Dual Calculation Modes: Switch between JavaScript (frontend) and Java (backend) calculations
- ✅ Special Offers: Automatic discount calculation (e.g., "3 for £1.30")
- ✅ Real-time Updates: Live total calculation as items are added/removed
- ✅ Responsive Design: Works on desktop, tablet, and mobile
- ✅ Error Handling: Graceful fallback if backend is unavailable
- ✅ RESTful API: Clean Spring Boot backend with proper validation
git clone <your-repository-url>
cd checkout-system# Navigate to backend directory
cd backend
# Install dependencies and start the server
./mvnw spring-boot:runExpected Output:
Started CheckoutSystemApplication in 2.5 seconds
Tomcat started on port(s): 8080
✅ Backend is now running on: http://localhost:8080
Open a new terminal window/tab and run:
# Navigate to frontend directory
cd front-end
# Install dependencies
npm install
# Start the development server
npm run devExpected Output:
Local: http://localhost:3000
-
Open your browser and go to
http://localhost:3000 -
Test Frontend Calculation:
- Add some items to your cart (try 3 × Item A, 2 × Item B)
- Ensure the dropdown shows "Javascript"
- Verify calculations are working
-
Test Backend Integration:
- Switch the dropdown to "Java"
- The indicator should show "Java Spring Boot" with a green dot
- Calculations should remain the same
- If you see any red error messages, check that your backend is running
-
Health Check:
- Visit
http://localhost:8080/api/checkout/health - Should return:
"Calculation service is running!"
- Visit
cd backend
# Run tests
./mvnw test
# Build JAR file
./mvnw clean package
# Run with different profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=productioncd fron