Schoolboys hunch over laptops in the opening scenes of two musicals that have won devoted teenage fanclubs. One writes a motivational letter to himself, “Dear Evan Hansen …”, in the Tony award-winning smash of the same name, currently in its fourth year on Broadway and recently opened in London’s West End. The other is Jeremy Heere, whose brain is “gonna freakin’ explode” while “waiting for my porno to load”, in the trippy sci-fi caper Be More Chill, which opens at the Other Palace in London this month.

These anxious adolescents’ nervous navigation of the school corridors have a lot in common – and so do both shows’ routes to success. While their plots highlight the more alienating, toxic corners of online life, the shows have won dedicated communities of young fans who come together to share their love in a digital blizzard of Tumblr fan art, fanfiction, YouTube animatics, streams, vlogs and #youwillbefound hashtags (as featured prominently on Dear Evan Hansen’s poster). More than the average musical, both shows built a following through the same sort of social media feeds that dominate the stage in the set design for Dear Evan Hansen.

When I drop in on rehearsals for Be More Chill, I’m keen to hear how the young cast first discovered the musical online. For Scott Folan, who plays the jittery Jeremy, it popped up on Spotify shuffle when he was listening to Dear Evan Hansen. Stewart Clarke – who plays The Squip, a supercomputer that helps Jeremy become popular – says that when he YouTubed Be More Chill he “found these animations that fans had made for the songs. I went on a deep dive … the amount of time and effort that had gone into them!” Soon after the cast was announced, Clarke explains, they received their own fan art. “Everyone started having drawings done of them. Our Instagram followers doubled.”

Two of the Be More Chill cast are no strangers to all of this. Millie O’Connell and Renée Lamb starred in Six, the irresistible pop concert that reclaims the stories of Henry VIII’s wives and went from student show at the Edinburgh fringe to a West End residency at the Arts theatre, where fan art of the actors in character hangs in the bar. “Our fans are amazing,” laughs O’Connell, whose performance of Don’t Lose Ur Head has had more than a million views on TikTok. Before the show was marketed with its own slick, shareable promos, fans’ homemade videos had already spread the word for them. During the concert’s encore, the queens take mobiles from the audience and pass them around on stage; these clips caught the energy of the show and propelled it to success.

Six fans create their own cosplay costumes – with O’Connell’s emerald-green Anne Boleyn outfit the most popular – and make animatic videos of the musical. One line in the show – “Remember us from your GCSEs?” – gets a big laugh from the audience, but what is striking is how many of them are too young to have even begun studying for the exams yet. If its heroines also appear in Tudor history lessons at school, the show nevertheless connects with today’s hyperconnected teens through quips about the queens getting unfriended and their comments going viral.

At the intimate Arts theatre, O’Connell says the queens were able to “look into everybody’s eyes and make sure we connect”. The Other Palace is a similar size and brings Be More Chill, which has music and lyrics by Joe Iconis and a book by Joe Tracz, back to its small-scale origins. It started out with a short run at the modest Two River theatre in New Jersey in 2015. Director Stephen Brackett, who has been with the production since that first staging, explains that they took two unusual decisions for such a small production. One was to record a soundtrack and the other was to release the rights for amateur productions (something that is usually held until after a New York run, for fear of losing ticket sales).

Gradually, the soundtrack for this tiny musical found an enormous audience online. Brackett thinks that there was a certain cult appeal for musical fans: “There’s currency in feeling like you’re finding something that not a lot of people know about.” Be More Chill grew to become the second most talked about musical on Tumblr after Hamilton. Soon, the streaming numbers were “overwhelming” says Brackett, “putting our musical in the conversation with shows that hit really big, like Hamilton and Dear Evan Hansen.”

Amateur productions of Be More Chill began to pop up around the US. At one, in a college, they realised that people were flying in from out of state to see it. “That was the first inkling that there was a ticket-buying audience out there.” The show secured a sold-out and extended off-Broadway run followed by a spell on Broadway (with Jeremy played in both productions by Will Roland, who would later be cast in Dear Evan Hansen). Be More Chill’s Broadway cast recorded a new soundtrack – by now the show had undergone script changes that chimed with fans’ feedback – and the total streams for both Be More Chill albums have now reach 350 million.

Dear Evan Hansen is playing at the Noël Coward theatre. Centre-left Sam Tutty (Evan Hansen), centre-right Lucy Anderson (Zoe Murphy). Photograph: Matthew Murphy

“In New York we were surprised by how many people knew the content in and out,” says Brackett. “A lot of people had formed a relationship with the show already. It was beautiful for us – how many kids felt seen, felt reflected in the musical.”

While teenagers helped bring Be More Chill to New York, its run was scuppered by the perception that – as the influential New York Times critic Ben Brantley wrote – it was the “theatrical equivalent of one of those high-pitched dog whistles that only those under 25 can hear”. Brackett reflects on being “caught in between a really rabid fanbase, who had a lot invested in the show, and some of the more heightened critics being pretty critical not only of the show but of the audience as well”. He says it raises questions about gatekeepers for musical theatre and the disconnect between fans and the handful of critics who offer “judgment on something that it seemed like a whole demographic were finding resonance in”.

Be More Chill was left in a tricky position on Broadway: projected as a teen musical but with wallet-hurting prices. Its UK cast agree that the cost of tickets is pivotal to ensuring that this new wave of musicals reaches audiences who are the same age as the characters and experiencing similar emotional difficulties. Both Dear Evan Hansen and Be More Chill deal with self-harm, trolling and anxiety, and speak plainly about sex. Miracle Chance, who plays high-school theatre nerd Christine Canigula in the show, remembers how seeing Spring Awakening – the 2006 musical about the turmoil of adolescence – made her realise she wanted to be an actor. Teenage audiences, she says, “connect with darker themes. That’s what you’re going through: emotions are so big at school. I think that’s why this and Heathers [the musical based on the cult Winona Ryder film] are so popular.” Lamb says Be More Chill is “something that people need at the moment – uplifting, light-hearted, but with a deep meaning”.

They may capture the flood of emotions engulfing school kids lit by the lonely glow of a laptop but Be More Chill and Dear Evan Hansen’s success is ultimately down, not just to their addictive soundtracks, but to feelings that long outlast your teenage years. Christine Canigula loves school-play rehearsals, she sings, “because you are equipped with directions and text – you follow a script so you know what comes next”. It’s a message that is perfectly paralleled by Dear Evan Hansen’s opening number, Anybody Have a Map?, sung by two parents who are fumbling through life just as much as their kids. The proof of this cross-generational appeal? One hashtag trending among all those about exam stress and unrequited crushes: #MomsofEvanHansen.