One morning in early March, Kyli Ledesma, a 20-year-old barista from San Diego, woke up at 3:30 so she could drive to Los Angeles to secure a copy of Cassandra Clare’s newest book, “Lady Midnight,” which would be for sale at Barnes & Noble at the Grove, a high-end mall, when it opened at 9. Yet she was not the first at the door.

Nor was Lydia Whitman, 15, who pulled in at 5 a.m., driven from Agoura Hills, Calif., by her mother to earn the 12th place in line.

Sales of the book were capped at 400, but the urgency propelling Ms. Ledesma, Ms. Whitman and the rest of Ms. Clare’s fans was that the first 100 purchasers would get a seat that evening at a question-and-answer session with Ms. Clare and the actors from “Shadowhunters,” the television show that has been made from her series.

A tour for Ms. Clare has more in common with that of a country music star than an author. She travels on a bus emblazoned with her name, and hundreds, even thousands, of fans may show up at her events.

She writes fantasy for the young-adult market, which means she’s an alternate-world builder, like J. K. Rowling and Stephenie Meyer, who sets her supernatural plots (Shadowhunters are humans, teenagers mostly, who are descended from angels and fight demons and such) in urban settings like New York City and Los Angeles.

Ms. Clare’s characters are tougher and wittier than the lugubrious Bella and Edward of “Twilight” fame, and her female protagonists are smart and sassy. Their appeal, besides the innate tension of teenagers on the verge, is their contemporary milieus and sharp dialogue.

“The books give you wonder in everyday life,” said Katherine Mann, 13, who had an armful of “Lady Midnight” copies she had bought for herself and family members. “She shows you that even if you live in a big city, there can be the possibility of fantasy.”

That evening in Los Angeles, there were fans from Seattle, Argentina and Sweden. One of them, Fanny Thorkildsen Fernandes, taught the crowd how to say “Shadowhunters” in Swedish. (It’s skuggjagare.)

Sogol Gharaei, 15, said she celebrates the day she began reading “City of Bones” — Ms. Clare’s first book, out in 2007 — each year by baking a cake and drawing a big rune on her arm, she said, “to keep the memory alive.” (Runes are part of the Shadowhunter’s arsenal, and appear mainly on body parts. As Sogol’s were, the arms of many attendees at the Barnes & Noble event were embellished with Sharpie-drawn examples.)

The 300 fans who didn’t score a seat at the talk waited patiently until Ms. Clare began signing books at 8 p.m. She would remain there until after midnight, when the last book wore her signature and she headed back to her tour bus to ice her hand and sleep while the bus drove all night to Salt Lake City, where the same scene would play out in a high school auditorium at an event sponsored by an independent bookstore.

This is the upside of Ms. Clare’s fandom. But there’s a darker, more complicated byproduct of her success. Twitter, Tumblr, Facebook and all manner of fan sites (as well as antifan sites or hate blogs — yes, that’s a thing) are sometimes fractious communities whose members she may engage with daily, and not always happily.

The place Ms. Clare occupies in publishing — and the work she does to keep herself there — is emblematic of the burdens and boons fan culture bestows on so many fantasy authors. Deeply possessive of the characters Ms. Clare has created, the fans can turn on her for plot directions they don’t approve of, or for the ways in which the television show diverges from the books. (Ms. Clare has no role in the TV series.)

Fantitlement, as this phenomenon is known, has raised her fortunes while at times it has bedeviled her, as it has so many of her peers. Laura Miller, a books and culture columnist at Slate who has written about fan culture, likened Ms. Clare’s experiences to that of George R. R. Martin, the “Game of Thrones” author whose fans grew so angry at his publishing pace that some created a blog, “Finish the Book, George.”

Ms. Clare’s Internet buffeting is intense and rampant. There are numerous blogs devoted to pillorying her. Some of this emotion has its roots in her own start as a fan fiction author; 16 years ago, she wrote some Harry Potter fan fiction called “The Draco Trilogy.” There were charges she lifted passages from the published, though out of print, work of a fantasy author named Pamela Dean without proper acknowledgment.

Fan fiction is a boisterous community of online writers, many of them women, who reimagine existing stories and characters, often in the fantasy realm, and often with erotic overtones: Spock paired with Uhura, say, or Spock with Captain Kirk are popular imaginings.

Harry Potter fan fiction is an enormous subgenre, with hundreds of thousands of examples online, according to Anne Jamison, an associate professor of English at the University of Utah and the author of “Fic: Why Fanfiction Is Taking Over the World.” (Why is it taking over the world? “Because it’s the first digitally native fiction,” Dr. Jamison said.)

Some work, like Ms. Clare’s, is embedded with references, direct quotes and even whole passages drawn from the fantasy canon, like in-jokes for the initiated. Some fans think this is part of the game, but others see it as a violation of the rules.

Cassandra Clare is the pen name of Judith Lewis, though most people in her circle, except her parents, call her Cassie. In person, Ms. Clare, 42, is more of a Hermione than a Bella.

Ms. Clare is the daughter of academics who spent her first two decades living in Tehran, London, Boston and Los Angeles. She retains the confidence of a precocious only-child who grew up with her nose in a book and largely in the company of adults. (Her mother, Elizabeth Rumelt, said her first words, “I want,” were uttered in Farsi.)

On any given day, her hair might be blue or pink, and she’ll be wearing a dress she designed herself from vintage patterns and in Liberty prints because as a plus-size woman she is often challenged to find clothing that matches her sensibility.

She took her pen name from “a terrible novel” she wrote in eighth grade called “The Beautiful Cassandra.” The title was a reference to a story Jane Austen wrote for her older sister, Cassandra. “In it, Cassandra meets a handsome young man and they fall in love and kiss,” Ms. Clare said. “And I was 13 and didn’t know what should happen next, so I killed him.”

Nearly a decade and a half later, Ms. Clare wrote her first piece of fan fiction. She was 25 and an assistant editor at The Hollywood Reporter, putting together a special section on “The X-Files” when she discovered the genre and tumbled down its rabbit hole (perhaps unsurprisingly, “The X-Files” have been catnip to fanfic folks).

“I printed it all out, and read it one night at the gym,” she said. “I almost fell off the NordicTrack.” That was when Ms. Clare created her “Draco Trilogy,” which begins with Harry Potter and Draco Malfoy switching identities and unspools toward a battle for Hermione’s affections.

(She was also writing as Cassandra Claire; she dropped the “I” when another fan-fiction author signed up all the “Cassandra Claire” domain names.)

In her book, Dr. Jamison devotes a chapter to the Clare brouhaha as a case study of Internet flaming and conflict. This particular one, she said, keeps getting rechurned. “Fan fiction looks like it’s a collaborative community playing by the same rules, but it turns out that it isn’t,” Dr. Jamison said.

Sarah Rees Brennan, an Irish young-adult fantasy writer who also came up from fan fiction, has had her own online snipers charging her with plagiarism and for being a friend of Ms. Clare. Ms. Miller of Slate, who said she was baffled by the depth of the animosity toward Ms. Clare, said she wondered if it had to do with her being one of the first writers to leave the “bubble” of fan fiction to become a published author, as if the leaving were a betrayal.

So does Elizabeth Minkel, who writes about fan culture for New Statesman, among other publications, and is a fan fiction author herself. “For whatever reason, when some people leave the community, there can be a legacy of negative feelings,” she said. “It gets passed down word of mouth. And once people get mad on the Internet, there’s no going back.”

Ms. Clare would add one more variable: gender.

“Do I think the animosity toward me from fandom is about my thinking of fan fiction as illegal art and mashing up quotes from books and movies and plays into the fan fiction I wrote 16 years ago?” she said. “No. A million people did that and still do. I was nothing different or special except that I went on to be a successful author and public figure. They’ve always been very clear it’s about punishing me for the latter, because it’s seen as being uppity. It’s not an old grudge being held on to. It’s the pattern of how women are treated on the Internet every day.”

As rowdy as the fan fiction arena is, there is just as much passion directed at Ms. Clare’s published work. There were fans who were angry that the television cast was not in the 2013 Shadowhunters movie, and Ms. Clare was vilified for not advocating for them.

These emotions have spilled out offline, too. Bookstores have received death threats against her; at a signing for “Clockwork Princess,” the final book of her second trilogy, set in Victorian England, a fan smashed a book down on her hand because the fan was enraged, Ms. Clare said, that a character had died.

“People are deeply uncomfortable with the idea that the characters they love and regard as people, real people, were made up by someone, especially if that someone is a woman,” she said.

Ms. Clare described a Twitter comment about one of her characters that read, “If it were up to you, Alec would be dead.”

“I pointed out that it is up to me,” Ms. Clare said. “And they seemed shocked to have to confront that fact, as if they couldn’t remember that actually I made up Alec, his reality had trumped mine.”

And then there are the legal disputes.

Young-adult and fantasy authors can earn millions, even if they are not household names like Ms. Rowling or Ms. Meyer.

“Lady Midnight” is Ms. Clare’s 10th book, and the first in a trilogy for which Simon & Schuster, her longtime publisher, paid her in the high seven figures. There are 36 million Shadowhunter books in print (as compared to Ms. Meyer’s 100 million for her “Twilight” books, and Ms. Rowling’s 450 plus million for her Harry Potter books), published in 35 languages.

“Lady Midnight,” out since March 8, is already in its second printing, with 600,000 copies, and it has landed at No. 1, as her books tend to do, on the New York Times best-seller list for her category.

“What you find with urban fantasy authors is the loyalty levels are intensely high compared to just about any other fiction category,” said Peter Hildick-Smith, chief executive of the Codex Group, which analyzes the book industry.

According to a survey conducted by Codex last week, Ms. Clare’s peak audience is women ages 18 to 24, among whom she’s as popular as Gwyneth Paltrow and Cameron Diaz. “She may not be a household name, but her fans are intensely loyal,” Mr. Hildick-Smith said. “It really determines how consistently you can be a best-seller.”

These high stakes may be why so many young-adult and fantasy authors find themselves ensnared by lawsuits.

In February, Ms. Clare was sued for copyright infringement, among other charges, by Sherrilyn Kenyon, an American young-adult author who writes an urban fantasy series about demon killers named Dark-Hunters. Ms. Clare’s lawyer, John R. Cahill, said he expected the suit to be dismissed and issued a statement that read, in part, “The lawsuit failed to identify a single instance of actual copying or plagiarism by Cassie.”

But the dispute puts Ms. Clare in good company: Ms. Meyer; Rick Riordan, another successful author who drew from Greek mythology when he created his young-adult series; and Ms. Rowling have all been sued for plagiarism, often more than once.

“Fantasy is a genre of tropes, and I think a lot of people don’t understand that,” Ms. Clare said of the lawsuit. Fantasy is also an enormously profitable publishing space, and franchises can extend indefinitely. Ms. Clare is on her third trilogy, and as John Sellers, the children’s reviews editor at Publishers Weekly pointed out, she has said she already has two more trilogies mapped out.

Interactive Feature | NYT Living Newsletter Get lifestyle news from the Style, Travel and Food sections, from the latest trends to news you can use.

“She is not limiting herself to geography or even time,” he said. “The only limit I think is what she’s willing to write. It’s a sprawling world she’s created, and it seems it’s only going to become more so.”

On a recent Thursday, Ms. Clare was briefly at home in Amherst, Mass., on the site of the new house the Shadowhunters books have bought for her and her husband, Joshua Lewis.

For the last two years, she and Mr. Lewis have been renovating a mid-19th-century former warehouse set beside a crashing waterfall. They bought it for about $400,000 and have put as much as $2 million into the renovation, Ms. Clare said. “We took everything apart and put it back together,” she said.

It’s now an Arts and Crafts showpiece. Stairs are painted to look like bookshelves; bathroom tiles are printed with quotes from their favorite authors, like J. M. Barrie and Oscar Wilde. Their bed is hand-painted with quotes from Verlaine and Rimbaud, and there’s even a hidden passage. “That’s for Josh,” Ms. Clare said.

The two met online over a decade ago, in a group for would-be children’s book authors, where they bonded over literary arcana. Mr. Lewis, now 37, was at the time working on a Ph.D. in computer science at the University of Massachusetts in Amherst. Ms. Clare was living in Brooklyn, working nights as a freelance copy editor for American Media, which publishes National Enquirer and Star, and writing “City of Bones” during the day.

Mr. Lewis, who also writes fiction and with whom Ms. Clare has collaborated on “The Shadowhunter’s Codex,” a manual for would-be Shadowhunters, said he knew he’d won Ms. Clare over when he identified a line from “Catch-22” in one of her early emails. Their wedding rings are inscribed with this phrase: “Are we not two volumes of the same book?”

They moved to Amherst in 2009, when Ms. Clare’s third book was published. Around that time, her store events began to change. “My first book event, my parents showed up, and maybe 10 people,” she said. “For ‘City of Glass,’ I went to Toronto for an event and 1,000 people appeared. I thought, my God, did something happen?”

Across the street from the house is a 1920s barn that’s been reimagined as a writing studio by Bruce and Melanie Rosenbaum, architectural designers with a specialty in steampunk design. They were so inspired by Ms. Clare’s work, they created a steampunk-inflected interior from salvaged apothecary shelves and an old soda fountain. A vintage English telephone booth will become a time machine. “Knowing Bruce,” Ms. Clare said, “it will probably work.”

Collaborating with a mechanical engineer, the Rosenbaums turned all the modern appliances into fantastical contraptions. A tiny steam engine has been electrified and fashioned to look as if it’s powering the ceiling fan.

There’s an iPad in an apothecary scale and the gleaming soda fountain holds a tiny clockwork angel (in homage to the title of one of Ms. Clare’s books) upon which play multicolored LEDs. It’s inscribed with a passage in Latin, “which I can’t read because I can’t read Latin,” Mr. Lewis said. “But it’s from Milton, and it’s something like, ‘If I can’t reach Heaven, I’ll raise hell.’”

“Actually, it’s from Virgil,” Ms. Clare said. Mr. Lewis beamed at her.

The microwave, a wildly elaborate device, has its own Latin inscription, an appropriate coda, perhaps, for Ms. Clare’s career: “Justice should be served hot.”