AIRY croissants, rich chocolate-chip biscuits, wedges of succulent cake—the goods at the City Bakery, in Manhattan, look delicious. Maury Rubin, its founder, studied in France. But his best creations are distinctly American: pretzel croissants (surprisingly tasty), and recipes for making money.

Mr Rubin is among those bakers who revere traditional methods but want a fat profit. However, a good bakery is bad business. Flour is cheap but organic butter, which makes up half a croissant, is not. Central locations for outlets are expensive to rent. In all, it costs Mr Rubin $2.60 to make a $3.50 croissant. If he makes 100 and sells 70, he earns $245 but his costs are $260. Since he refuses to sell leftovers—all goods are sold within a day—he loses money. “Welcome to the bakery business,” Mr Rubin says.

The obvious fix is to raise prices. But Mr Rubin says shoppers bristle when the cost of baked goods passes a certain threshold. He has two main solutions. First, don’t be just a bakery. He also sells fancy salads and sandwiches to office workers, which have higher margins.

Second, use data to cut waste. Mr Rubin studies sales to discern trends in demand, then adjusts supply accordingly. There are no brownies or carrot cake on Mondays or Tuesdays—people don’t buy rich desserts after decadent weekends. He watches the weather closely, as demand melts in the rain. He keeps an eye on school calendars, to bake less when children are away. He bakes more after the fasting of Yom Kippur, when demand from Jewish customers picks up. And each day, after the breakfast rush, he fine-tunes supply by checking sales every 60-90 minutes. Trays of pastries are ready to be baked, but nothing goes into the oven until the numbers are in.

Having no croissants at the end of the day is a sign of success. Late one recent afternoon, his counter offered trios of fruit on triangles of rice paper, cooked in sugar. This dessert looks lovely and is cheap to make. But Mr Rubin will sell only a few, as he makes them expensive: they are there in part to make his counters look pretty and full, to draw in coffee-drinkers at the end of their working day. Such strategies have helped the City Bakery survive since 1990. It now has seven smaller shops in New York and seven outposts in Japan, with plans to open in Dubai.