Komal Ahmad/Feeding Forward

One lunch changed Komal Ahmad's life.

It was 2011. She had just come back from Navy summer training and was attending the University of California at Berkeley to start work on her undergraduate degree.

While she was walking near campus one fall day, a homeless man approached her, asking for money to buy food because he was hungry. Instead of giving him cash, Ahmad invited the man to lunch. As they ate, he told her his story. He was a soldier recently returned from Iraq and had a bad turn of luck.

"He'd already gone on two deployments and now he's come back, he's 26 and on the side of the road begging for food," Ahmad said. "It just blew my mind."

It bothered her so much that she decided to do something about it. Within a few months, Ahmad set up a program at UC Berkeley called Bare Abundance that allowed the school's dining halls to donate excess food to local homeless shelters. With that program, she then joined forces with a nationwide group called Food Recovery Network, which currently has food recovery projects on more than 140 college campuses across the US.

Ahmad, now 25 years old and CEO of a nonprofit service called Feeding Forward, is looking to expand even more into what she calls on-demand food recovery.

Through a website and mobile app, Feeding Forward matches businesses that have surplus food with nearby homeless shelters. Here's how it works: when companies or event planners have surplus food, they tap the Feeding Forward app and provide details of their donation. A driver is dispatched to quickly pick up the leftovers and deliver them to food banks.

Now playing: Watch this: Donate old gadgets for a good cause

"Imagine a football stadium filled to its brim," Ahmad said. "That's how much food goes wasted every single day in America."

Excess food is a serious issue in the US. After paper, food scraps are the nation's second largest source of waste, according to the US Environmental Protection Agency. Leftovers fill 18 percent of landfills and make up over 30 million tons of what is sent to dumps each year. When cut off from oxygen, the organic matter creates methane gas and contributes to global warming.

"Imagine a football stadium filled to its brim. That's how much food goes wasted every single day in America." Komal Ahmad, CEO of Feeding Forward

At the same time, the EPA says that roughly 50 million people in the US don't have access to enough food. That's more than 15 percent of the population -- or nearly one in six people.

"In the US, about 40 percent of the food we grow never gets eaten," said JoAnne Berkenkamp, a senior advocate in the Food and Agriculture Program at the nonprofit Natural Resources Defense Council. "We have a lot of people in the US who don't know where their next meal is coming from. That's a travesty. We have such an abundance, and people are in a state of scarcity."

Food recovery isn't a new idea. Hundreds of organizations across the country, including Move for Hunger and the Society of St. Andrew, orchestrate donations to food banks and food rescue centers. But in the past couple of years, the tech sector has been getting involved. On-demand food delivery service Munchery, founded in 2010, donates its excess meals to food banks in the Bay Area. An app called LeftoverSwap, created by a pair of entrepreneurs two years ago, helps people give away their leftovers to strangers. And the Food Cowboy app, founded in 2012, gets surplus food from wholesalers and restaurants and delivers it to soup kitchens.

Since Feeding Forward launched in 2013, the service, which so far serves only the San Francisco Bay Area, has recovered more than 684,000 pounds of food. That means it's fed more than 570,000 people and diverted more than 3.42 million pounds of carbon dioxide emissions from landfills.

Why on-demand?

A few months after starting the food recovery program in Berkeley, Ahmad got a call from a dining hall manager ready to donate 500 leftover sandwiches. She leaped into action, renting a Zip Car and calling dozens of homeless shelters and organizations to see who wanted the food. About a third of the shelters didn't answer the phone, another third didn't need the food, and the remaining group told her they'd take just 10 to 15 sandwiches.

Komal Ahmad/Feeding Forward

"It was me on the side of the road, so frustrated and so upset," Ahmad said. "There's no lack of people who are in need of food. This is not a hunger issue. This is a distribution issue."

So Ahmad started thinking about how she could streamline the process of taking food from the haves and delivering it to the have-nots.

In 2012, Ahmad collaborated with a developer, and at the end of the year, Feeding Forward won the Angelhack Silicon Valley hackathon. The on-demand service officially launched in 2013. Feeding Forward recently took its app off the Google Play and Apple app stores for an overhaul. New versions of the app will be released by August 2015, Ahmad said. The website version of Feeding Forward is still up and running.

On-demand apps and services have become big business in the last few years -- think of Uber, which has become the second-highest-valued venture-backed company in the world on the back of its ride-hailing service. While Uber's rides can be as practical a necessity as the taxi trips they displace, on-demand services often have a more frivolous component, such as dispatching a hairstylist, kitten or craft beer to your home.

In addition to letting individuals offer up food donations, Feeding Forward works with businesses and event planners. To earn money to fund its operations, Ahmad and her eight-member team charge event organizers for the service they provide. Ahmad declined to give details on the pricing scale.

One event Feeding Forward just partnered with was the Bite Silicon Valley food-tech conference in Santa Clara, Calif. At the three-day event in early June, celebrity chefs whipped up pork ragu arrancini and ice cream flavored with Frosted Flakes and bourbon. Meanwhile, startups demonstrated ways to 3D print desserts and make tacos on solar-powered stoves.

Ahmad said Feeding Forward collected six trolleys full of food from the event. That was a total of 5,135 pounds of food, which fed more than 4,279 people in eight different shelters and food banks and diverted more than 25,675 pounds of carbon dioxide emissions from landfills.

To make Bite Silicon Valley's food donation as easy as possible, Feeding Forward brought containers and provided the manpower to box up the leftovers -- since the event's planners didn't have packaging for the excess food.

"The key for events and chefs is to make it as turnkey as possible," said Caryl Chinn, founder of Bite Silicon Valley. "The [chefs] were really relieved and happy to see the food wouldn't go to waste."

Why has it taken so long for such food waste recovery programs to become popular? For starters, donating leftovers in the US isn't easy. Potential donors worry they'll be liable if something goes wrong with the food. But it turns out that donors are protected by a federal law called the Bill Emerson Good Samaritan Food Donation Act, which shields "good faith" donors from liability.

Another problem is that leftovers are perishable, so they need to be distributed or refrigerated quickly. Matching donors with recipients on a fast timeline can be tricky. Ahmad said Feeding Forward's biggest bottleneck is figuring out which food banks can take large quantities of leftovers immediately.

Berkenkamp, from the NRDC, believes on-demand apps like Feeding Forward can help solve this distribution problem, because they systematize the process of matching donors with recipients.

"These mobile apps can connect the dots in our food system," Berkenkamp said. "To have technology that connects in real-time is critical. It's a real advance."

While the amount of food being recovered with on-demand apps isn't much compared with what's being tossed, the technology is starting to make a dent in food waste and in feeding people in need. Moving ahead, Ahmad said she hopes to expand Feeding Forward to cities outside the Bay Area, including Seattle and Boston.

"These are huge cities that have absurd amounts of food thrown away every day," Ahmad said. "We are trying to make the Bay Area a case study to say 'Hey, if it works here, it can work anywhere.'"

Correction, June 29 at 5:05 p.m. PT: Clarifies that Komal Ahmad attended Navy summer training, rather than Navy medical training.

Correction, August 6 at 9:35 a.m. PT: Ahmad's original food-recovery program at UC Berkeley didn't expand to different universities, it joined forces with a network that helped people develop new programs at their own schools. The story has been changed to reflect this.