The FoodHub Backend is the server-side application responsible for handling business logic, authentication, database operations, and API endpoints.
It provides REST APIs that the frontend consumes to manage meals, users, and orders.
- Node.js
- Express.js
- MongoDB / PostgreSQL
- JWT Authentication
- bcrypt (password hashing)
- User authentication
- Role-based authorization
- CRUD operations for meals
- Order management
- Review management
- Admin moderation
POST /api/auth/register
POST /api/auth/login
GET /api/auth/me
GET /api/meals
GET /api/meals/:id
GET /api/providers
GET /api/providers/:id
POST /api/orders
GET /api/orders
GET /api/orders/:id
POST /api/provider/meals
PUT /api/provider/meals/:id
DELETE /api/provider/meals/:id
PATCH /api/provider/orders/:id
GET /api/admin/users
PATCH /api/admin/users/:id
Stores authentication and role information.
Additional information for providers.
Food categories (cuisine types).
Menu items offered by providers.
Customer orders including items and status.
Customer feedback for meals.
PLACED → PREPARING → READY → DELIVERED
Optional: CANCELLED
- Install dependencies
npm install
- Configure environment variables
Create .env
PORT=5000 DB_URI=your_database_connection JWT_SECRET=your_secret_key
- Start server
npm run dev
or
node server.js
Server runs at:
- Passwords hashed with bcrypt
- JWT authentication
- Role-based access control
- Protected routes for customer, provider, and admin