
Weekend Deployment Challenge: Smart Grocery Sorter
An AI-powered serverless web app that automatically organizes grocery shopping lists using Amazon Bedrock, AWS Lambda, and API Gateway.
Series: WeekEnd-Challenges (7 articles)
- …
- 6Weekend Deployment Challenge: Smart Grocery Sorter This article
Introduction
For the AWS Deploy Your First App Weekend Challenge, I wanted to take a simple everyday problem and turn it into a working application using AWS.
Every week, creating a grocery shopping list can become a repetitive task. A list might contain fruits, vegetables, dairy products, grains, meat, and household supplies all mixed together. Before going shopping, I usually need to reorganize the list into categories so that it is easier to follow in a supermarket.
To make this process easier, I built Smart Grocery Sorter, an AI-powered serverless web application that automatically organizes grocery items into meaningful categories.
The application uses Amazon Bedrock, Amazon Nova Lite, AWS Lambda, and Amazon API Gateway to process and categorize the grocery list. The frontend is built using HTML, CSS, and JavaScript and provides a simple interface where users can enter their grocery items and sort them with a single click.
This project demonstrates how generative AI and serverless AWS services can be used to automate a small but repetitive everyday task.
What My App Does
Smart Grocery Sorter allows users to enter their grocery shopping list, with one item per line.
For example, a user can enter:
- Milk
- Apples
- Rice
- Chicken
- Toothpaste
- Tomatoes
- Cheese
After clicking Sort List, the application sends the grocery list to the backend.
The backend uses Amazon Bedrock with the Amazon Nova Lite model to intelligently categorize the items.
The categorized grocery list is then returned to the browser and displayed in an organized format.
Instead of manually sorting a grocery list before going shopping, the application performs the task automatically within seconds.
Problem Statement
Creating a grocery list is simple, but reorganizing it before shopping can become repetitive.
A typical shopping list may contain items from different sections of a supermarket:
- Fruits
- Vegetables
- Dairy
- Meat
- Grains
- Household supplies
- Personal care products
Manually organizing these items takes additional time and can become annoying when the list is large.
I wanted to build a simple application that could:
- Accept an unorganized grocery list
- Automatically identify the type of each item
- Group items into meaningful categories
- Return the organized list quickly
- Avoid requiring users to manually sort everything
The goal was to solve this small recurring problem using generative AI and serverless AWS services.
How I Built It
I wanted to build a lightweight application with a simple frontend and a serverless backend.
I started by creating the frontend using HTML, CSS, and JavaScript. The interface contains a text area where users can enter grocery items and a Sort List button.
When the user clicks the button, JavaScript collects the grocery list and sends it as a JSON request using the Fetch API.
For the backend, I created an AWS Lambda function using Python.
The Lambda function receives the grocery list, creates a prompt, and sends it to Amazon Bedrock using the Amazon Nova Lite foundation model.
The model processes the grocery items and returns a categorized list. Lambda then formats the result as a JSON response and sends it back through Amazon API Gateway to the frontend.
During development, I encountered several challenges.
The first challenge was testing the Lambda function. Initially, the function expected API Gateway events only, which caused problems when testing directly from the Lambda console because the event structure was different. I updated the function to support both Lambda test events and API Gateway requests.
The second challenge was configuring CORS in API Gateway. Since the frontend runs in a browser, requests between the frontend and backend were initially blocked by browser security policies. I configured Cross-Origin Resource Sharing (CORS) in API Gateway and redeployed the API.
Another challenge was testing the frontend locally. Opening the HTML file directly from the file system resulted in browser security restrictions. I solved this by using VS Code Live Server to run the frontend through a local web server.
After testing the complete workflow, I deployed the backend using AWS Lambda and API Gateway and verified the API using PowerShell and browser testing.
AWS Services Used / Architecture Overview
This project uses fully managed AWS services for the backend and AI processing.
Amazon Bedrock
Amazon Bedrock provides access to the Amazon Nova Lite foundation model.
The model is responsible for analyzing the grocery list and categorizing the individual items.
AWS Lambda
AWS Lambda hosts the Python backend without requiring me to manage servers.
Lambda receives the request from API Gateway, creates the AI prompt, sends it to Amazon Bedrock, processes the response, and returns the categorized grocery list.
Amazon API Gateway
Amazon API Gateway provides the HTTPS API endpoint used by the frontend.
It receives the HTTP POST request from the browser and invokes the Lambda function.
Architecture
The application follows a simple serverless architecture:
User│▼HTML / JavaScript Frontend││ HTTP POST Request▼Amazon API Gateway││ Invokes▼AWS Lambda (Python)││ Prompt▼Amazon Bedrock(Amazon Nova Lite)││ Categorized Grocery List▼AWS Lambda││ JSON Response▼FrontendThe frontend is publicly accessible through a web deployment, while the AI processing and backend logic are handled by AWS services.
How the App Is Triggered
The application is triggered when the user clicks the Sort List button.
The frontend collects the grocery items and sends an HTTP POST request to Amazon API Gateway.
API Gateway invokes the AWS Lambda function.
Lambda creates a prompt using the submitted grocery list and sends it to Amazon Bedrock's Amazon Nova Lite model.
After receiving the categorized response, Lambda returns the result through API Gateway.
Finally, the frontend displays the organized grocery list to the user.
This creates a complete request-and-response workflow using serverless AWS services.
What I Learned
This project gave me hands-on experience building a complete serverless AI application using AWS.
I learned how to:
- Invoke Amazon Bedrock foundation models from AWS Lambda
- Work with Amazon Nova Lite
- Connect Amazon API Gateway with Lambda
- Build an HTTP API for a browser application
- Handle different Lambda event formats
- Configure CORS for browser applications
- Test APIs independently
- Connect a frontend application to a serverless backend
- Deploy and test an application using AWS services
One of the most useful lessons was understanding how different parts of a cloud application connect together.
The application itself is simple, but making the frontend, API Gateway, Lambda, and Amazon Bedrock communicate correctly required testing and troubleshooting.
This project also showed me that generative AI does not always need to be used for a large or complicated application. It can also be useful for automating small repetitive tasks.
Future Improvements
There are several features I could add to Smart Grocery Sorter in the future:
- Allow users to edit categories manually
- Add drag-and-drop grocery items
- Save shopping lists for later
- Add a shopping checklist
- Add user accounts
- Store lists using Amazon DynamoDB
- Add authentication using Amazon Cognito
- Create a mobile-friendly progressive web app
- Add multilingual grocery sorting
- Add AI-powered shopping suggestions
These improvements could turn the current simple sorter into a more complete grocery planning application.
Link to App or Repository
Live Demo
Source Code
The live frontend provides a way to test the application, while the public GitHub repository contains the source code for the frontend and backend.
The backend functionality is powered by Amazon API Gateway, AWS Lambda, and Amazon Bedrock using Amazon Nova Lite.
Conclusion
For the AWS Deploy Your First App Weekend Challenge, I wanted to build something small, useful, and actually deployable.
That idea became Smart Grocery Sorter, an AI-powered web application that takes an unorganized grocery list and automatically turns it into categorized sections with a single click.
The application combines a simple HTML, CSS, and JavaScript frontend with Amazon API Gateway, AWS Lambda, and Amazon Bedrock with Amazon Nova Lite.
Building this project gave me practical experience with serverless architecture, APIs, generative AI, Lambda, CORS, and frontend-to-cloud communication.
It is a simple application, but it demonstrates how a small everyday problem can be turned into a working application using AWS managed services and generative AI.

lambda-i

IAM-I

API-R

API-S

before-sorting-demo

after-sorting-DEMO
Series: WeekEnd-Challenges (7 articles)
- …
- 6Weekend Deployment Challenge: Smart Grocery Sorter This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article