The days of the insulin pen may be numbered. According to researchers in Switzerland, the future of diabetes treatment will not be a shot in the arm after a meal, but a shot of espresso instead.

The scientists hope to transform the lives of diabetics who need regular jabs with an implant that contains hundreds of thousands of designer cells which churn out medicine when they sense caffeine in the bloodstream.

Tests on diabetic mice showed that such an implant inserted under the skin could be triggered by the caffeine in coffee, tea or energy drinks to produce a drug that controlled the animals’ blood sugar levels. To raise the dose, the scientists simply administered stronger coffee.

“You could completely integrate this into your lifestyle,” said Martin Fussenegger, who led the team at the Swiss Federal Institute of Technology in Zurich. “You have a tea or coffee in the morning, another after lunch, and another at dinner, depending on how much drug you need to get your glucose back down.”

The implant will not be ready for humans any time soon. Fussenegger believes it could be a decade before the necessary tests and trials are done to demonstrate that the approach is safe and effective. But if it does work, it could replace the regular injections that many diabetics require. “You could have your normal life back. The implant could last for six months to a year before it would need to be replaced,” said Fussenegger.

Writing in the journal Nature Communications, the Swiss researchers describe how they modified human cells to make a diabetes drug called GLP-1. The drug stimulates so-called beta cells in the pancreas to produce insulin which in turn controls blood sugar levels.

The designer cells contain a “gene circuit” that enables them to sense caffeine molecules as they sweep by in the bloodstream. When the cells detect caffeine, they react by manufacturing GLP-1. The implant is made up of thousands of gel-like capsules that each contain hundreds of the designer cells. “When you inject them under the skin, they stick together like caviar,” said Fussenegger. The gel capsules shield the cells from the immune system, but allow caffeine in and GLP-1 out.

To see how well the cells worked, the scientists exposed them to drinks with varying levels of caffeine, from chocolate milkshakes and herbal tea to cola, black tea, Red Bull, Starbucks coffee, and a range of instant coffee pods. Herbal tea and chocolate milkshakes had no effect on the cells, but all the other drinks triggered them to make GLP-1 in varying amounts depending on their caffeine content.

More than 400 million people worldwide are affected by type-2 diabetes and controlling blood sugar levels is a crucial part of managing the condition. A treatment that calls for shots of caffeine will not work for everyone, but Fussenegger is optimistic. “It could be quite an improvement in everyday life for these people. I don’t know many who drink neither tea nor coffee,” he said.