The Grocery List Manager Backend is built using Node.js and Express.js and serves as the API layer for the full-stack Grocery List Manager application.
This backend handles user authentication, grocery list creation, pantry tracking, meal planning, budget management, shopping history, and dashboard analytics.
It is fully integrated with Supabase (PostgreSQL) as the database and follows a clean MVC (Model-View-Controller) architecture to ensure modularity, scalability, and maintainability.
- Node.js
- Express.js
- Supabase (PostgreSQL Database)
- dotenv (Environment Variables)
- CORS
- JSON Web Token (JWT)
- bcrypt (Password Hashing)
- Postman (API Testing)
The backend follows the MVC architecture pattern:
backend/ │ ├── controllers/ ├── routes/ ├── middleware/ ├── config/ ├── utils/ └── server.js
- Routes → Define API endpoints
- Controllers → Contain business logic
- Middleware → Handle authentication and error handling
- Config → Supabase database configuration
- Utils → Helper functions
- server.js → Entry point of the backend server
Authentication is implemented using JWT (JSON Web Token).
Features include:
- User Registration
- User Login
- Protected Routes using middleware
- Secure password hashing with bcrypt
POST /api/auth/register→ Register a new userPOST /api/auth/login→ Login an existing user
POST /api/grocery/lists→ Create a grocery listGET /api/grocery/lists→ Get all grocery listsPUT /api/grocery/lists/:id→ Update a grocery listDELETE /api/grocery/lists/:id→ Delete a grocery list
POST /api/grocery/items→ Add an item to the grocery listGET /api/grocery/items/:listId→ Get items in a grocery listPUT /api/grocery/items/:id→ Update an item in the grocery listDELETE /api/grocery/items/:id→ Delete an item from the grocery list
POST /api/pantry→ Add a pantry itemGET /api/pantry→ Get all pantry itemsPUT /api/pantry/:id→ Update a pantry itemDELETE /api/pantry/:id→ Delete a pantry item
POST /api/meals/plans→ Create a new meal planGET /api/meals/plans→ Get all meal plansDELETE /api/meals/plans/:id→ Delete a meal planGET /api/meals/suggestions→ Suggest meals based on pantry and preferences
GET /api/budget→ Get the current user's budgetPOST /api/budget→ Set a new budget
POST /api/shopping/complete→ Complete shopping and save historyGET /api/shopping/history→ Get shopping history for the user
GET /api/dashboard/stats→ Get dashboard statistics
The backend connects to Supabase using the official @supabase/supabase-js client.
- Users
- Grocery Lists
- Grocery Items
- Pantry
- Meals
- Budget
All backend APIs were tested using Postman to verify:
- Authentication flow
- CRUD operations
- Protected route access
- Database response handling
- Error handling
1️⃣ Clone the repository:
git clone https://github.com/Divyasree-Manpoor/backend-grocery
cd grocery-backend