The novel begins in August 1793, in the city of Philadelphia. Mattie Cook is a 14-year-old girl who lives with her mother and grandfather and helps them to run a thriving coffeehouse business. Amidst the intense summer heat, residents of Philadelphia begin to sicken and die from a strange disease that is eventually identified as yellow fever. Many people have different opinions on the best way to control the epidemic, and within Mattie's family, there are debates about whether she should be sent to the country for her own safety. However, before a decision can be reached, Mattie's mother falls seriously ill.
Mattie does the best she can to care for her mother, but both her mother and the doctor who is treating her recommend that she be sent away to avoid contagion. Reluctantly, Mattie and her grandfather begin the journey to stay with family friends, the Ludingtons, in the countryside. On the way there, her grandfather becomes sickly and is accused of having yellow fever. Because the other travelers are fearful of contagion, Mattie and her grandfather are abandoned outside of the city with no way to get back. Mattie manages to provide food and water for her grandfather while he recovers, but collapses herself, having contracted yellow fever while caring for her mother.
Mattie awakens to find herself being cared for in a hospital, where her grandfather had been able to take her. Due to the skilled care she receives, Mattie makes a full recovery, and then she and her grandfather return to the coffeehouse to reunite with her mother. However, when they arrive, Mrs. Cook is not there, and the chaos of the disease-ridden city makes it impossible to find out what has happened. Mattie and her grandfather move back into the coffeehouse, although it has been robbed and looted in their absence, and they find it very difficult to obtain food and other necessities. After a few days, thieves break into the house. Mattie and her grandfather try to defend themselves; they succeed in scaring off the thieves, but her grandfather dies due to injuries from the confrontation.
Mattie is now utterly alone. By chance, she finds a young girl named Nell who has been orphaned in the plague. Mattie decides to care for Nell, and shortly thereafter, she runs into Eliza, who had worked at the coffeehouse as a cook. Eliza has been living with her brother, elderly mother, and nephews, and she agrees to allow Mattie and Nell to move in with them as well. For a time, this arrangement works, but then the three young children all contract yellow fever. Eliza and Mattie bring them back to the coffeehouse and nurse them there. Miraculously, all three children survive, and when the temperatures drop and the frosts start to appear, the disease begins to wane.
As the city recovers, Mattie reopens the coffeehouse, now working with Eliza as her partner. One day, Mattie's mother suddenly returns. She had mistakenly believed that Mattie and her grandfather were in the countryside, and she had gone after them. When she got there and didn't find them, she panicked and ended up relapsing with fever. For weeks, she was too ill to do anything and had to stay in the country to recover. Mattie is very happy to reunite with her mother; however, her mother's health will never fully recover, so Mattie now has to take on a much more adult role in managing and running the business. The novel ends with Mattie healthy and hopeful about her future.