- Node.js v18+ installed
- MongoDB Atlas account (free tier works)
- Git installed
Create a .env.local file in the backend folder with your MongoDB credentials:
# MongoDB Connection String (get from MongoDB Atlas)
MONGODB_URI=mongodb+srv://YOUR_USERNAME:YOUR_PASSWORD@cluster.mongodb.net/hunger_hive?retryWrites=true&w=majority
# JWT Secret (any random string)
JWT_SECRET=your_super_secret_key_here_12345
# Server Port
PORT=4000
# Node Environment
NODE_ENV=developmentcd backend
npm installnpm run devThe backend should now be running at http://localhost:4000
Create a .env file in the frontend folder:
VITE_API_URL=http://localhost:4000cd frontend
npm installnpm run devThe frontend should now be running at http://localhost:5173
cd admin
npm installnpm run devThe admin panel should now be running at http://localhost:5174
This error occurs when:
- Backend is not running - Start the backend server first
- Wrong API URL - Check
VITE_API_URLin frontend.env - MongoDB not connected - Verify your
MONGODB_URIis correct
- Go to MongoDB Atlas → Network Access
- Add your IP address or use
0.0.0.0/0for development - Check your username/password are correct
The backend already has CORS configured for localhost. If you're deploying:
- Add your frontend URL to the CORS whitelist in
backend/server.js
- Open http://localhost:5173 in your browser
- Register a new account
- Browse the menu
- Add items to cart
- Proceed to checkout
- Place an order
If all steps work, your setup is complete! 🎉
- Push your code to GitHub
- Connect your repo to Render/Railway
- Set environment variables in the dashboard
- Deploy
- Push your code to GitHub
- Import project in Vercel
- Set
VITE_API_URLto your deployed backend URL - Deploy
- Check the main README.md for more details
- Open an issue on GitHub
- Contact: your-email@example.com