The poop economy is flourishing.

Nature gets to the fundamentals of the filthy lucre we’re finding in filth:

The facility is called Pivot, and its founder is Ashley Muspratt, a sanitation engineer who lived in Ghana, Kenya and Rwanda for more than seven years before moving back to the United States last year. Muspratt insists that Pivot is not a treatment plant. It’s a business. Its product powers local industries such as cement and brick plants. “I describe us as dual sanitation and renewable-fuel company,” Muspratt says. “Our model really is to build factories.”

Muspratt is part of a growing band of entrepreneurs trying to address one of the biggest challenges in public health — poor sanitation — and to turn a profit doing it.

Making fertilizer or fuel is the most obvious, but researchers and entrepreneurs are exploring other uses. Some are growing plants in drying beds or breeding catfish in the artificial ponds that facilities typically use to treat sludge. Others are drying out sludge and incorporating it into building materials such as cement and bricks. Beyond that, companies are exploring whether certain fatty acids in sludge could provide important components of bioplastics and industrial chemicals. Larvae that feed on faeces are being pressed to make an oil for industrial uses, and in the future they could be used as animal food.

These approaches reflect a rethinking of sludge treatment — with the end product, and not just public health, in mind from the start. The economic model of sanitation is also changing, moving from an entirely public service to one run at least partly by private enterprises that are finding value in excrement, says Doulaye Kone, deputy director of the Water, Sanitation and Hygiene Program at the Bill & Melinda Gates Foundation in Seattle, Washington. Under the old model, he says, “there’s no opportunity to sell anything, and then the government has to pay for operational costs. The day the budget dries up, everyone is in trouble.” As a result, many treatment plants in developing countries now lie abandoned.

Many wastewater treatment plants worldwide, including in the United States, where biosolids are a common by-product of treated sludge, give it away to avoid disposal costs. In Tema, a city east of Ghana’s capital Accra, however, a new plant just sold its first few 50-kilogram bags. The operation should turn a profit within three years, says business economist Solomie Gebrezgabher, who works in the Accra office of the International Water Management Institute (IWMI).

The Tema plant uses a process that treats the sludge and composts it simultaneously. Powered by the Ghanaian sun, it consumes much less energy than composting methods that use drying and heating machines. But it takes a lot of space and time, and can be smellier. For about the first ten days, the sludge, which comes from both private homes and public toilets, dries in sand-filled beds, which allow the water to drain out and evaporate away. Then it’s mixed with sawdust or food waste and transferred to a covered shed. Workers turn it regularly, and it breaks down over two months, thanks to naturally occurring microbes. During this process, it gets hot enough to destroy pathogens. Then it’s spread out to cool and mature. The inexpensive process is appropriate for the conditions in Ghana, Gebrezgabher says. “It doesn’t have to be high-tech.”

With the product and the potential buyers in hand, the IWMI team partnered with the district government and a private local waste management company called Jekora Ventures, based in Accra. At full capacity, the plant, which opened in April, will process the waste from about 65,000 to 100,000 people every year into 500 tonnes of fertilizer. The company will start splitting profits with the municipality once the plant breaks even.

But the black soldier fly (Hermetia illucens), which is native to tropical climates, is different: it feeds voraciously in its larval stage, when it stays more or less in one place, and not at all as an adult, making it much less of a health risk.

The fly was put to work on food waste by a Cape Town-based firm, AgriProtein. It developed factories to harness the fly’s special habits. The company breeds flies in cages, hatches the eggs in a nursery and then transfers the larvae to the food waste, where they eat their fill. Two weeks after hatching, the larvae naturally migrate off the waste to pupate, making both them and the remaining compost easy to harvest separately. The factories dehydrate the larvae to make an animal feed or extract a fatty oil, which has a range of uses from cosmetics to biodiesel. The leftover organic matter becomes a soil conditioner. Last year, AgriProtein opened the first industrial-scale plant of this type, with a plan for worldwide expansion close behind.