In a television studio in North Hollywood, Rachel Bloom is jumping up and down, shouting, “Alex Trebek thinks I’m smart!” Bloom — the co-creator, co-writer, and star of the CW series Crazy Ex-Girlfriend — has just received an invitation to be on Celebrity Jeopardy. Several members of show's crew prostrate themselves on the floor of the set. One asks her how this news compares to her recent Golden Globe win for Best Actress in a TV Comedy. “I mean, it’s apples and oranges,” she deadpans. A few seconds later, she’s crowing, “What is ‘A dream come true?’”

For many people, the answer to that question might be “Rachel Bloom’s career.” The 28-year-old writer-actress-songwriter-producer does so many different jobs on Crazy Ex that the word “multi-hyphenate” feels inadequate. After years of success with comedic music videos such as her 2010 viral hit “Fuck Me Ray Bradbury” — a filthy come-on to the then-80-year-old science fiction legend — she teamed up with Aline Brosh McKenna, the writer and producer of The Devil Wears Prada. Together they created Crazy Ex-Girlfriend, a comedy that is somehow just as sunny as it is bleak, about lost love, suburban weirdness, shame, and mental illness.

Bloom plays Rebecca Bunch, a depressed New York lawyer who impulsively picks up and moves to West Covina, California, a small city in the Valley, where her summer camp boyfriend Josh Chan (Vincent Rodriguez III) just happens to live. Off her meds and full of a hope indistinguishable from mania, Rebecca pursues Josh romantically while forming relationships with his friends and her new colleagues. Also, it’s a musical: Each episode features at least two original comedic songs, stylistically spanning from Fred and Ginger–inspired tap numbers to ’80s hair metal to EDM. Aside from being Crazy Ex’s executive producer and star, Bloom writes songs and serves as creative director; interviewing her during production is a stop-start process that often ends with her apologizing while walking backward toward the set.

For all the accolades the show has earned — besides the Golden Globe, it’s garnered rave reviews from TV critics enamored with the show’s portrayals of depression, complex women, and bisexuality — success hasn’t altered the production's frantic course. Every day they are on set, cast and crew drive past the pornographic bookstore (it made a cameo in the pilot’s introduction to West Covina), and park across the street from a secondhand tuxedo shop. The demands of such an ambitious production means that everyone working on the show is in constant motion, most especially those who are responsible for the music.

Besides Bloom and McKenna, the core Crazy Ex music team is rounded out by Jack Dolgen, doing double duty as a writer and the music consultant, and Adam Schlesinger, the executive music producer. Dolgen is Bloom’s longtime musical collaborator — he’s worked in film and TV comedy for years. Schlesinger, who handles nearly all the invisible work of birthing fleshed-out tracks from writer’s room brainstorms, is the bassist and co-songwriter for power-pop outfit Fountains of Wayne, late of “Stacy’s Mom” fame; with his tousled hair and Converse, he resembles the world’s coolest Wilco dad.

This nucleus is in constant communication: As Dolgen puts it, “every time I go to the bathroom I’m emailing with Adam or texting Rachel about lyrics.” Because the songwriting operates as a tandem production to the show proper, it’s often forced into the periphery of the team’s schedules — at least for Bloom, McKenna, and Dolgen, who have duties outside of the show’s music. They work weekends, on location between takes, and together in the car on commutes in order to get it all done.

There have been musicals on television for as long as the medium has been around, but they haven’t successfully captured audience attention until recently. While one-off musical episodes of TV shows like Buffy the Vampire Slayer or Scrubs are fondly remembered, traditional musical shows have had a tougher time sticking around. ABC’s 1990 singing-police drama Cop Rock is one of the most infamous flops in TV history; Smash, NBC’s star-studded Broadway drama-turned-camp trashterpiece, was one of the most hate-watched shows of the past few years. The most successful musical series of the 2000s, Glee, featured very little original songwriting, relying instead on familiar hits — and though it remained a ratings success, lost much of its critical cache after a lauded first season.

In the last few years the success of both Nashville and Empire have paved the way, though neither show quite counts as a full-on TV musical. All of the music is performed by characters who are also performing artists, which both makes the songs less narratively interesting and puts more pressure on them to be objectively good. (Give or take a “Drip Drop,” they rarely are.) Crazy Ex-Girlfriend leans into those same constraints to produce something different, and maybe tougher still: consistently excellent comedic songs that land their jokes by poking at pop song conventions.

“Women Gotta Stick Together,” sung by Josh’s haughty girlfriend Valencia, starts out as a rousing Indigo Girls–inspired bit of folky feminist-feelgood before Valencia detours into insulting every woman in town. Rachel’s boss Darryl sings a country ballad called “I Love My Daughter (But Not in a Creepy Way)” which goes straight into the discomfiting canon of father-daughter love songs like Bob Carlisle’s “Butterfly Kisses.” (The entire music team winces when asked about Dolgen’s first draft, which they all describe as having been “not safe for television.”) The Fifth Harmony riff “Put Yourself First” highlights all the ways that pop culture’s instructions for self-care are suspiciously similar to what men want.

One of the show’s first major numbers, “The Sexy Getting Ready Song,” is an inventory of the emotional, physical, and physiological labor women do to make themselves attractive to men, set to R&B. When rapper Nipsey Hussle shows up and witnesses Rebecca’s primping routine, he reacts in horror and responds by calling every woman he’s ever dated to apologize. It’s funny but also depressingly true-to-life: Wwhile pitching an upcoming song about urinary tract infections in a meeting with CBS executives, McKenna discovered some of them didn’t know what a UTI was. She recalls this incident with weary laughter. “I think of it as a public service.”

There’s a whiteboard in the writers’ room covered in song ideas and possible approaches to untouched genres. (Bloom especially wants to do a Europop song.) But none of the pitches on the wall has ever been used. Instead, the writers consistently conceive songs while breaking a given script, formed around what Bloom calls the “emotional tentpoles” of an episode. Do Rebecca, Darryl, and their co-worker Paula need to rally an apartment building full of people to join a class-action suit? That’s a song. Is Rebecca berating herself for lying to Josh? Another song. And once a concept is in place, the bulk of the actual songwriting work moves away from the writer’s room.

It’s the middle of an airless Tuesday afternoon, and Schlesinger and Gold have spent almost their entire day in a single dimly lit room within their studio in Burbank. It’s a 15-minute drive from the lot, but it still manages to feel as if it's a whole country away — where the Crazy Ex lot is a hive of constant activity, the studio has a monastic hush. A series of massive monitors displays different processes in Pro Tools. A giant whiteboard calendar sits on the floor, nearly blank — trying to systematically document the work has become a fool’s errand. They count on each other to keep everything moving.

It helps that Gold and Schlesinger, who have been producing original music for TV series including The Dana Carvey Show, Crank Yankers, and Saturday Night Live since the late ’90s, are so familiar with each other they barely need to communicate verbally: When a song is coming along well, they’ll chuckle assent; when it’s not, they’ll silently switch spots between the workstation and one of the other chairs in the studio. The eminently good-natured Schlesinger hums to himself while he fiddles around with Pro Tools, nodding gently when something is working, murmuring when it doesn’t. Gold, who’s taller and sharper-tongued, researches possible lyrics on his laptop and tries to keep up with the ungodly number of email chains he and Schlesinger have going with the rest of the production staff.

Before Crazy Ex-Girlfriend was picked up by The CW last spring, Bloom and Dolgen had planned on writing all of the music themselves, with the occasional assist from a guest writer. This wasn’t as ambitious as it sounds: The series had originally been in development at Showtime, which would have meant a significantly shorter season, not to mention more flexibility for the sort of vulgar comedy the pair had developed on videos like “Fuck Me Ray Bradbury." (Asked to describe their sensibility, Dolgen replies, “There’s usually a jizz joke of some kind, or people are dying.”) But with the expanded episode order and sudden rush toward production, the pair needed help.

Luckily, McKenna knew Adam Schlesinger. He’d been roommates with her husband two decades earlier, when, as she puts it, “he was just a band dude.” Bloom and Dolgen had discussed the show with Schlesinger only once, more than a year earlier, in a brief meeting. But once the show got picked up, McKenna insisted to CBS that they had to hire him. Schlesinger, she says, was “not only the right guy for it, but the only guy.”

Schlesinger’s TV and film songwriting resume is impeccable. In addition to his comedic work with Gold, he contributed to the Josie and the Pussycats soundtrack, and was nominated for an Oscar for writing the title song from That Thing You Do. The breadth of this skill and his ability to wing it is crucial, as Schlesinger frequently produces well outside of his pop/rock wheelhouse, such as with this season’s French cabaret sendup “Sexy French Depression." Schlesinger speaks fondly of the research required — which, in this case, meant watching a bunch of French movies and listening to the chanteuse Juliette Gréco — but that additional time investment crunches his already-precarious schedule.

The demands made on Schlesinger are considerable — he’s produced every song since Episode 3, writes many of them himself, and gives input on the others, pitching lyrics and musical ideas as needed. He and Gold estimate that they work on eight songs in a given week, including producing playback tracks for actors’ recording sessions, tweaking music for episodes currently in production, vocal syncs for videos that have already been filmed, and mixing the final products, all in addition to helping with musical concepts and jokes.

Coming from years of working in theater, Schlesinger and Gold initially weren’t sure it was possible to pull it all off. “It takes a decade for [a theatrical musical] to get onstage, and that’s 12 songs,” Schlesinger says. “Every month we’re doing that much music on this show, and it’s because nobody said, 'Oh, that’s impossible.'” But McKenna’s background is in television, not music, and a heightened pace of songwriting didn’t seem particularly difficult when she brought them on board. “Aline didn’t know,” Schlesinger says, laughing. “She was just like, 'Oh, let’s have three or four new songs every week,' and we were like, 'OK, great!'”

Schlesinger likes to focus his time on Crazy Ex’s pop and rock music, and not just because they’re his speciality. He feels strongly that these songs have to sound like believable, plausible examples of the genres they’re riffing on without veering into on-the-nose parody. “It can’t just be some corny beat,” Schlesinger emphasizes. “If you see any comedy music and the beat just sounds like somebody didn’t know what they were doing, it kind of ruins the joke.” Gold is blunter: “It’s gotta sound like a hit.” This is their target for the day, fleshing out what everyone on set has taken to calling “The UTI Song.”

The concept for the song, which airs in the penultimate episode of the season, celebrates Rebecca contracting a UTI from her robust sex life as a kind of badge of honor; Bloom was interested in “glorifying something gross and kind of mundane.” After starting as a soulful, Barry White–style number, which was rejected for being too trite, “I Gave You a UTI” turned into something rocking, putting it squarely on Schlesinger’s shoulders. Dolgen, Bloom, and McKenna’s quickly approve Schlesinger’s scratch demo, and he’s off to work.

“I Gave You a UTI” comes together in just a couple of hours. After watching the music video for Nathaniel Rateliff and the Night Sweats’s “S.O.B.” — the primary reference point for the song — Schlesinger pulls out a guitar and strums out the initial melody and vocals, and maps the track in a few takes. After adding in guitar and horn part on his keyboard, he’s already halfway done. He samples a single handclap and builds it into full-on call-and-response chorus. The demo is nearly done, and he hasn’t left his chair once.

While Schlesinger works on the music, Gold is focused on the lyrics — today, he’s the one tasked with looking up euphemisms for “penis.” A line in Schlesinger’s draft using the word “schlong” has been flagged by the network’s standards and practices division — apparently, it could be construed as denoting penis size, which is problematic from a broadcast standpoint — and the entire songwriting team has been emailing back and forth about what might replace it. As Schlesinger plugs away at the keyboard, Gold, absorbed in a sordid Urban Dictionary’s deep dive, mutters the phrase “pork sword” under his breath.

Three days after Schlesinger crafts the skeleton for “I Gave You a UTI,” one of the show’s stars is in the studio — a small, padded space in a corner of the Crazy Ex-Girlfriend production office, plastered with posters like a dorm room — recording the vocals. (It would constitute a major spoiler to identify the actor.) McKenna sits in one of the studio’s too-large armchairs, emailing Schlesinger about “schlong” alternatives. Dolgen follows her in from the writer’s room, sweeping back his thick blond hair and adjusting his glasses while asking for more rasp in the vocals. With the recording session in progress, they’re having the actor substitute some possibilities. Bloom quietly sneaks into the studio and scribbles down a few phallic phrases before running back to set. With just three working days until they have to shoot the scene, Gold, only half-joking, suggests that the actor try singing all 176 different euphemisms for “penis” he’s sent around.

Before the recording is finished, Bloom has to run back to the set — she’s filming a scene for an upcoming episode involving a black-box theater’s musical adaptation of Moby Dick. She described the song she’s about to sing in a voice memo to Schlesinger as “wannabe fuckin’ Sondheim opera” — and he wrote the whole thing in 20 minutes before starting on “I Gave You a UTI.” She scans updates from the recording session on her iPhone while a slightly shorter makeup artist weaves around her, touching up her lips and eyebrows.

In the hiatus before work officially begins on the recently announced second season, Bloom tells me, she and McKenna will take a retreat together and write as much of the season as possible in advance. It’s a front-loading model that forces a sprint toward the finish, much like the one they’re currently experiencing, but that doesn’t bother Bloom. “I like this way of doing the music,” she says, gesturing in the direction of the rest of the team. “The fundamental thing is that I trust everyone else.”

Then she’s off to film the Moby Dick scene, part of an episode in which Rebecca revisits her past, A Christmas Carol-style, with an assist from the “dream ghost” of her therapist. For much of the episode, Rebecca is focused on her inability to find romantic love; the ghost tells her she’s coming at it the wrong way. “Forget about the guys,” she tells Rebecca. “Love doesn’t have to be a person. It can be a passion.” Rebecca reflects on the centrality of musical theater to her life, and for a moment you can hear Bloom’s vigor and vision peeking out from behind the character’s neuroses and timidity. “When things get tough,” she says, “it’s how I understand the world.”