Eco Expiry: Build a Smart Expiry Date Tracker with MIT App Inventor
What if your phone could help you remember when your food or medicines expire?
Imagine finding a packet of milk in the refrigerator and wondering, “Is this still good?” Or discovering a medicine in a cupboard and not remembering its expiry date. Instead of depending only on memory, we can build a simple mobile app that helps us keep track of expiry dates!
Meet Eco Expiry, a smart expiry-date tracker created using MIT App Inventor. In this STEM project, students learn how an everyday problem can be turned into a working mobile application using visual programming.
The best part? You don’t need to be an expert programmer. MIT App Inventor lets you create apps by connecting colorful blocks, much like putting together puzzle pieces.
The Challenge: Can We Reduce Waste?
Every day, food and other products are thrown away because people forget about their expiry dates. Sometimes, products are discovered only after they have expired.
Your challenge: Can you design an app that helps people keep track of products and their expiry dates?
Before reading further, think about it:
Think Like an Inventor
Suppose you have these three products:
| Product | Expiry date |
| Milk | 10 August |
| Bread | 15 August |
| Juice | 5 August |
Today is 12 August. Which product should the app identify as expired?
- Milk
- Bread
- Juice
- All three
Answer: C — Juice!
The app needs to compare the expiry date with the current date. This simple idea becomes an important part of our programming logic.
Meet Eco Expiry
Eco Expiry is designed as a simple Smart Food & Medicine Expiry Tracker. Eco Expiry has a simple home screen with three main options:
- Add Product
- View Products
- About
The goal is to keep the interface simple so that a user can understand what to do without complicated instructions.
Image 1:The Eco Expiry home screen provides access to the main features of the application.
The design process itself is an important part of app development. Before writing any blocks, students need to think about what the user should see and how the user will move through the app.
Design Challenge
Imagine that you are designing your own sustainability-related app. What would you consider when choosing the colors, buttons, text size, and layout?
A good interface should not only look attractive. It should also be clear, simple, and easy to use. The Eco Expiry home screen provides access to the main features of the application.
Step 1:Create the home screen
As we discussed earlier we can make the home screen like image1.
The block section look like this:
Image 2: blocks showing navigation from home screens
Step 2: Create the Add Product Screen
The first important feature is allowing the user to enter a product and its expiry date. The Add Product screen contains:
- Text Box for the product name
- Date Picker for selecting the expiry date
- Save button
- Back button
- Tiny DB
- Notifier
- Clock
Image 3: Users enter a product name and select its expiry date on the Add Product screen.
For example, a user could enter:
Product Name: Milk
Expiry Date: 15-08-2026
But there is an important question:
How can the app remember this information?
That brings us to one of the most useful programming concepts in this project.
Step 3: Give the App a Memory
Eco Expiry uses TinyDB to store product information.
You can think of TinyDB as a small digital storage space inside the app. When a user saves a product, the app stores the information so that it can be retrieved later.
In the blocks, the app uses:
TinyDB1.StoreValue
The saved products are associated with the tag “Products”.
Block Detective
What do you think TinyDB1.StoreValue does?
- Opens another screen
B. Saves information
C. Selects an expiry date
D. Displays an alert
Answer: B — it saves information.
This introduces students to the idea of data storage. A mobile application often needs to remember information entered by its users.
Step 4: Working with Dates
A computer needs dates to be represented in a form that it can process.
In Eco Expiry, the Date Picker provides the selected year, month, and day.
The blocks then use:
- DatePicker1.Year
- DatePicker1.Month
- DatePicker1.Day
- Clock1.MakeInstantFromParts
- Clock1.FormatDate
These blocks work together to create and format the selected date.
The final date is displayed using the pattern:
dd-MM-YYYY
For example:
15-08-2026
Predict the Output
Suppose a student selects:
- Year: 2026
- Month: 8
- Day: 25
What should the app display?
Answer: 25-08-2026
This is a simple example of how programming can take separate pieces of information and combine them into a meaningful result.
Step 5: What Happens When the User Clicks Save?
Now we move to the Blocks section of MIT App Inventor.
When the user clicks the Save button, several things happen.
The app:
- Gets the product name from the Text Box.
- Gets the selected expiry date.
- Creates and formats the date.
- Adds the product and expiry date to the product list.
- Stores the updated list using TinyDB.
- Displays a “Product Saved Successfully!” message.
- Clears the Text Box.
Image 4: The Save blocks combine product information and the selected date, store the data in TinyDB, and provide feedback to the user.
This is where students can see how several small blocks work together to create one useful feature.
Step 6: Use Lists to Manage Products
Eco Expiry uses a Product List to keep multiple products together.
Imagine that a user wants to store ten products. Creating a separate variable for every product would make the program difficult to manage.
Instead, a list can contain many related items.
For example:
Milk — 15-08-2026
Bread — 20-08-2026
Juice — 05-08-2026
Students therefore learn an important programming concept: lists help us organize collections of information.
Arrange the Steps
Can you put these actions in the correct order?
- Store the product
- Enter the product name
- Select the expiry date
- Click Save
- Format the date
Correct sequence:
Enter product name → Select expiry date → Click Save → Format the date → Store the product
This is called algorithmic thinking: breaking a task into a logical sequence of steps.
Step 7: View the Saved Products
When the user selects View Products, the app opens the Viewscreen.
When the screen initializes, the app retrieves the saved information using:
TinyDB1.GetValue
The products are then prepared for display in a List View.
The user can see the products and their expiry dates in one place.
This demonstrates another important idea in app development:
Data is collected, stored, retrieved, processed, and displayed.
Image 5: view screen
Image 6: View screen blocks
When the View Screen opens, Eco Expiry retrieves the saved products from TinyDB. The app then goes through each product in the list and extracts its expiry date. Using Date And Time Tools, it gets the current date and checks whether the stored expiry date has already passed. If an expiry date is earlier than the current date, the product is added to the expired-products message. Finally, the app displays the saved products in the List View and shows an alert if expired products are found.
Conclusion
Eco Expiry demonstrates how a simple everyday problem can become a meaningful technology project.
By building this app, students explore user-interface design, lists, variables, data storage, date handling, conditions, loops, notifications, and problem-solving.
MIT App Inventor makes this process accessible because students can learn programming concepts through visual blocks.
Eco Expiry therefore becomes more than an app. It becomes an opportunity for students to connect technology, mathematics, science, engineering, and sustainability in one project.
Frequently Asked Questions
1. Is Eco Expiry suitable for beginners?
Yes. MIT App Inventor uses visual programming blocks, making it suitable for students who are beginning to learn programming and app development.
2. Why is TinyDB used in the Eco Expiry app?
TinyDB is used to store the product list so that the app can retrieve the saved information later.
3. How does Eco Expiry identify expired products?
The app compares the stored expiry date with the current date. If the expiry date has already passed, the product is identified as expired and included in the alert.
4. Can students add their own features to Eco Expiry?
Yes. Students can extend the project by adding features such as expiry-soon alerts, search, categories, product statistics, or improved visual indicators.















