This project is a full-stack vending machine application with a C++ backend and a React/MUI frontend.
vending_machine/
├── backend/ # C++ API server
└── frontend/ # React frontend
-
macOS:
# Using Homebrew brew install cmake make -
Windows:
- Download CMake from CMake Downloads
- Download Make from GNU Make for Windows
- Add both to your system PATH
- Restart your terminal after installation
-
macOS:
# Install Xcode Command Line Tools xcode-select --install -
Windows:
- Download and install Visual Studio Community
- During installation, select "Desktop development with C++"
- Or install MinGW-w64
-
macOS:
brew install openssl
-
Windows:
- Download from OpenSSL for Windows
- Install the full version (not light)
- Add OpenSSL to your system PATH
-
macOS:
# Using Homebrew brew install nodeOr download from Node.js Official Website
-
Windows:
- Download the LTS version from Node.js Official Website
- Run the installer and follow the instructions
- Restart your terminal after installation
Note: After installing Node.js, verify your installation:
node --version npm --version
cd frontend
npm install
npm run dev:allThis will start both servers:
- Backend at: http://localhost:8080
- Frontend at: http://localhost:5173 (or next available port if 5174 is in use)
cd backend
make runAvailable make commands:
make build- Build the projectmake run- Build and run the servermake clean- Clean build filesmake help- Show available commands
cd frontend
npm install
npm run dev-
Start the Backend:
- Use
make runin the backend directory - The backend will automatically build if needed
- Use
-
Start the Frontend:
- The frontend will automatically connect to the backend
- Hot reloading is enabled for development
- Changes will be reflected immediately
-
Making Changes:
- Backend changes require a server restart (
make runagain) - Frontend changes are automatically reloaded
- Both Windows and macOS users can work on the same codebase
- Backend changes require a server restart (
-
Backend Won't Start?
- Check if port 8080 is available
- Verify OpenSSL is installed correctly
- On Windows, ensure Visual Studio C++ tools are installed
- Try
make cleanfollowed bymake run
-
Frontend Can't Connect?
- Ensure the backend is running
- Check browser console for CORS errors
- Verify both servers are using the correct ports
- If Make is not found:
- Add Make to your system PATH
- Restart your terminal
- If OpenSSL is not found:
- Add OpenSSL to your system PATH
- Restart your terminal
- If Xcode tools are missing:
xcode-select --install
- If Homebrew is not installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The backend provides the following endpoints:
GET /api/items- Get available itemsPOST /api/insert-money- Insert money (body: { amount: number })POST /api/purchase- Purchase an item (body: { item: string, quantity: number })POST /api/return-change- Return change
If you have issues, please check the console output and error messages, then ask for help with the details.