In July 2009, The Times ran an article by David Leite, a cookbook author and food writer, that chronicled his quest for the perfect chocolate chip cookie. The recipe he developed as a result of his deep dive into flour types, hydration periods, chocolate percentages and salt ratios is loosely adapted from Jacques Torres, the famous pastry chef and chocolatier. David’s recipe, which calls for two kinds of flour and 36 hours of “aging” in the fridge, has become a cult favorite among NYT Cooking readers. One reader wrote that it’s “THE only chocolate chip cookie recipe you’ll ever need.”

But if you eat a gluten-free or vegan diet, you’ve been out of luck. Until now!

The editors at NYT Cooking charged me, a recipe developer and food stylist, with the task of developing vegan and gluten-free versions of the famous recipe. After many hours of baking, 400 cookies, seven types of flour and endless taste-tests, I am happy to say that I landed on two great recipes that will satisfy your chocolate chip cookie craving. Here’s how I did it.