Decker’s biography shows that Hesse’s life was an uneasy compromise between his spiritual absolutism, which pushed him in the direction of irascible isolation, and his human needs, which encumbered him with wives, children, and houses that he never quite wanted or accepted. Married three times, he was unhappy as a husband and as a father, and the characters in his books mostly shun both roles. His last novel, “The Glass Bead Game,” is a futuristic fantasy about an academy of scholars who are all male, and all single.

It is not surprising that Hesse would remain attuned to adolescence, since his teen-age years, in the eighteen-nineties, were the most dramatic and consequential period of his life. It was then that Hesse was first forced to confront the entire weight of the institutions ranged against him—family, church, school, society—and do battle with them in the name of defending his individuality. He won, but not without sustaining deep wounds; in a sense, his fiction is a series of reënactments of this primal struggle.

From a very young age, it was clear that there was a mismatch between Hesse and his family. He was born in 1877, in Calw, a small town in the Black Forest, in southwest Germany, where his father and grandfather worked together in a Christian publishing house. On both sides, he was descended from devout Pietists—members of a German Protestant sect that, like the Methodists in England, rejected the established church in favor of a fervently inward, evangelical striving for virtue. In Decker’s words, Pietism “regarded as the devil’s work everything that did not serve the ultimate purpose of preparing one for the kingdom of God in the hereafter.” When it came to child-rearing, this conviction translated, at least in the Hesse family, into a concerted effort to break the young Hermann’s will, to teach him the docility and submissiveness that God demanded.

Yet in Hermann this religious force met an immovable object. “I was the child of pious parents, whom I loved tenderly and would have done even more so had they not made me aware from a very early age of the Fourth Commandment. Unfortunately commandments have always had a catastrophic effect on me,” Hesse recalled in an autobiographical sketch. Compelled to honor his father and mother, he instinctively refused. In one incident recorded in his mother’s diary, the three-year-old Hesse put an iron nail in his mouth, and, when he was told he could die if he swallowed it, he stubbornly replied, “I don’t care! If I die and go to my grave, I’ll just take a couple of picture-books with me!” Some years later, his father contemplated sending him away “to an institution or to be raised by another family.” For his part, Hesse recalled that, as a child, he would dream of setting the family’s house on fire and of murdering his father.

These tensions boiled over in 1891, when the fourteen-year-old Hesse enrolled in Maulbronn Monastery, an élite state-run boarding school housed in a medieval abbey; its mission was to recruit the region’s brightest boys and turn them into Lutheran ministers. Getting into Maulbronn required passing a gruelling examination, an experience that marked Hesse so deeply that he returned to it in several novels. Indeed, many of his books are not just novels of education—the Bildungsroman that had been a classic genre in European literature since Goethe—but specifically novels of schooling. Each of the dormitories at Maulbronn, for instance, had a grandiose name; Hesse lived in Hellas, a tribute to the school’s conventional idolatry of ancient Greece. Fifteen years later, when he came to fictionalize his school days in the novel “Beneath the Wheel,” the main character goes to just such a school and lives in a dormitory called Hellas. And thirty-seven years after that, in “The Glass Bead Game,” Hesse told the story of Joseph Knecht, who once again lives in a dormitory called Hellas.

“Beneath the Wheel” assigns many of Hesse’s own experiences to Hans Giebenrath, a gifted boy who is emotionally destroyed by the pressure of studying to get into a Maulbronn-like school. He passes the examination, but only by cramming so intensively that his boyish love of life is extinguished. He is soon overcome by apathy and despair, and has to drop out; in the end he drowns in a river, possibly a suicide. The conclusion of the book channels the self-pity that Hesse remembered so well: “All nausea, shame and suffering had passed from him; the cold bluish autumn night looked down on the dark shape of his drifting body and the dark water played with his hands and hair and bloodless lips.” (The very title of the book is an indictment, and “Beneath the Wheel” belongs with other German works of the period, such as Frank Wedekind’s “Spring Awakening” and Heinrich Mann’s “The Blue Angel,” as an exposé of a soul- and libido-crushing educational system.)

Hesse avoided Hans Giebenrath’s fate, but only barely. In March, 1892, he ran away from Maulbronn and was reported missing. He returned after just a day and, as Decker writes, truancy hardly sounds like an unprecedented crime for a fourteen-year-old. But the reaction from school and family was extreme. It speaks volumes about his parents’ religious sensibility, for instance, that his mother’s response to the news of his disappearance was to hope that he was dead: “I was very relieved when I finally got the feeling . . . that he was in God’s merciful hands,” she wrote in her diary.

Unfortunately, he returned alive, a bigger headache than ever. Hesse had to leave school, and his parents, unable to cope with him, resorted to having him committed to a mental asylum. Facing the prospect of indefinite, possibly lifelong incarceration, he bombarded his parents with heartbreaking letters: “I loathe everything here from the bottom of my heart. It is like it has been designed especially to show a young man how wretched life and all its aspects are.”

After several months, Hesse was released on a trial basis, and he was able to attend a local high school. But the damage to his relationship with his parents was permanent: when his mother died, in 1902, he refused to attend the funeral. And the damage to his career seemed equally irreparable. At Maulbronn, he was on a fast track to a prestigious and secure job as a minister or a teacher. Now college was out of the question, and Hesse became an apprentice to a bookseller. To his parents—often, surely, to himself—it must have looked as if he had failed for good.

But Hesse’s genius was to embrace this failure and make it his inspiration. “In the beginning was the myth” is the first sentence of “Peter Camenzind,” the book that rescued Hesse from poverty and obscurity; and many of his books are retellings of the same myth, one that Hesse devised to interpret his own unhappy existence. Indeed, Hesse’s novels are best understood as successive versions of a spiritual autobiography—a form that, ironically, was a staple of Pietist literature. “The only way I can conceive” of writing, Hesse once said, is “as an act of confession”—a statement that could have been endorsed by his paternal grandfather, a doctor who left behind a memoir in two volumes. Indeed, in rebelling against his Pietist upbringing, Hesse ended up recapitulating its central themes: he never lost the habit of rigorous self-examination or his feelings of unworthiness and his longing for an experience of the divine.