By the tender age of 19, Mary Shelley had lost her mother and her child, battled depression and written an iconic horror novel, “Frankenstein.”

How she accomplished the latter feat is the subject of the Boston Playwrights Theatre’s “Hideous Progeny.” It begins on a summer night in 1816. Young, yet legendary poet Lord Bryon — the Justin Bieber of the time — and his friends are vacationing in Switzerland.

“They’re teenagers left to their own devices, essentially. There’s a lot of sex and a lot of drinking and a lot of secrets,” explains Krista D’Agostino, the play’s director. “The difference is that these guys have a hell of a lot of talent and ambition.”

When Byron challenges the group to a ghost stories contest, Shelley scribes a now-familiar tale about a doctor and his disastrous creation.

Most readers don’t realize the parallel between the story and the young author’s life, how themes of immortality and absent maternal figures dominate both.

“A lot of people look at ‘Frankenstein’ as this warning against the rapid transformation of the soon-to-be industrialized world, and it’s easy to just look at it as that,” says D’Agostino. “But in this play, the correlation to Shelley’s life is so obviously there.”

It makes sense that the mastermind behind the gruesome sci-fi book would have a heartbreaking backstory.

“She lived her life through death and carried it everywhere,” says D’Agostino. “And that’s what enabled her to write ‘Frankenstein.’”