In the early aughts Mindy Kaling was best known as a writer and actor on the workplace comedy “The Office.” Taking that training with her own interest in romantic comedies, she conceived a vehicle for herself that set out to blend the two genres. First premiering on Fox in 2012, “The Mindy Project” went on to 117 episodes, six seasons and one notable network change (to streaming service Hulu mid-way through its run) before Kaling was ready to say good-bye.

“I really fell in love with the format where the main character was very flawed. It was something you had seen countless times on sitcoms with men, but you hadn’t seen with women. And I was so excited to play that part in a bigger capacity than I had,” Kaling says of her earliest pitch for the show.

The character of Mindy Lahiri was born out of Kaling’s desire to explore a woman, who “like many of us, becomes fixated on the things that we don’t have.” So while the show started with her already on her way to being a successful doctor with a killer wardrobe, she was more of a mess personally – in part because of unrealistic expectations set up by the romcom movies she obsessed over in her youth and in part because working 60-70 hours a week didn’t leave her a lot of time to date. But she was also born from Kaling’s studies.

Kaling compares Mindy’s journey to that of Odysseus’ in “The Odyssey.” “Any hero has to face trials in order to get to what they want,” she says. While Odysseus had to be “batted around the Mediterranean for years” before he could reunite with his love, Mindy, too, had to face trials. Never designed to be a conventional “angelic” lead or “moral compass” of the characters, Kaling felt it would not have been authentic to give Mindy a traditional path to love and happiness.

The show centered on the character of Mindy “becoming the best version of herself” through the years and showcased her growth through her relationships with a rotating and equally evolving group of friends, co-workers and lovers. The first three seasons of “The Mindy Project” saw a number of cast changes as executive producers Kaling and Matt Warburton let the show tell them what it should be. While Warburton admits that the changes “bothered some people at the time,” he credits them for also “saving the show” in the long haul.

“We were completely flexible,” Warburton says. “Our one North Star was the POV of this really interesting character in Mindy. As long as we were in the head of that character, it kind of didn’t matter where the rest of the show lived.”

This meant that through the years the show didn’t shy away from turnover at fictional doctors’ office Shulman & Associates, be it doctors including Peter (Adam Pally) and Jody (Garret Dillahunt) joining the practice or a core character like Danny (Chris Messina) leaving, which gave the show a chance to reinvent itself in the latter half of its run. It also meant that some characters, such as Jeremy (Ed Weeks) or Beverly (Beth Grant) revealed different layers of their personalities as time went on.

Although the first three seasons of “The Mindy Project” received full season orders at Fox, Warburton says that they didn’t really feel like they had true job security. “A lot of the time we were shooting the finale and we didn’t know if we were going to come back for the next season,” he recalls.

Ike Barinholtz, who first joined the show as a writer and then went on to star as Mindy’s right-hand nurse Morgan and even direct some later season episodes, says there was a lot of pressure in the first few years because of the episode order and traditional broadcasting model.

“We were still living in that overnight numbers model, so every Wednesday morning, you’d look at Twitter and go, ‘Oh s–t! How did we go from a 1.3 to a 1.2?’ That pressure is very real, and Mindy never wanted to let us down,” Barinholtz says.

“The Mindy Project” started with the wedding of Mindy’s ex and will end with the nuptials of her co-workers.

In those first three seasons, the show burned through story quickly in case there wasn’t another chance. Then in May 2015, the hammer fell: Fox decided not to move forward with a fourth season, leaving the characters dangling in a cliffhanger of Mindy being pregnant with Danny’s baby and Danny making a grand gesture by flying to India to introduce himself to her parents.

Only a week after the broadcast network pulled the plug, Hulu swooped in and ordered a 26-episode fourth season.

“We learned how to put our foot on the gas pedal at Fox because we had to, but then we got to do that in later seasons because we wanted to,” Warburton says. “Once we got to Hulu, we knew how many more seasons we were going to do, and we knew they were going to let us, so we got to really plan.”

Although being on a streaming service that didn’t answer to the same Standards & Practices of a broadcast network provided more freedom, the team took extra care to make sure “The Mindy Project’s” DNA remained intact. “Your show lives long past when you first air it, so it was very important to us that 10 years from now a young woman watching the show isn’t going to know the difference between ‘Oh that was a Hulu episode and that was a Fox episode.’ We really wanted to make sure it was the same show,” Warburton says.

While being on Hulu allowed “The Mindy Project” to take some larger storytelling swings in fantasy episodes such as the fourth season premiere “While I Was Sleeping,” in which Mindy imagines her life if she had never fallen in love with Danny, as well as the fifth season’s “Mindy Lahiri Is a White Man” or “Hot Mess Time Machine,” the core of the show remained Mindy’s character growth.

“We wanted to evolve Mindy from the person you saw in the pilot, but still be the person you loved before you knew too much about her,” Warburton says.

After all, over the course of the seasons, Mindy’s dogged determination to have it all, and her unwillingness to compromise on the way she got it all – whether it meant pounding two bear claws every morning, giving up her beloved walk-in closet so her infant son could have a real space of his own, or getting divorced when she realized her marriage wasn’t her true happily ever after – inspired viewers across demographics.

“As a minority woman in media and entertainment, you were only allowed to be a role model. That’s the only way you could be portrayed on TV and in film, certainly six years ago,” Kaling says. “If you’re anything but, then there’s enormous amount of pushback and pressure for you to be that way. But the biggest thing the show has managed to do is never compromise. And I think the thing I’m most excited about with the show is to watch it stand the test of time and see young women – particularly young women of color – watch the show in five years and see she didn’t have to be perfect.”

In wrapping up the series with a sixth and final season, therefore, the most important thing was to “protect the character and pay off what the audience has been rooting for,” Warburton says. And this meant striking a balance of “hard jokes and comedy with real emotion” in order to deliver “earnest moments and character epiphanies.”

“I’m a little bit of a traditionalist,” Kaling admits. “It doesn’t have to be a happy, saccharine ending, but I want you to feel closure.”

But it was also important to be able to “live in the moment and have fun with” the show, per Barinholtz. “We felt so lucky to have this thing that we created that people responded to, and we wanted to enjoy it as much as possible,” he says. “The mood of the set comes from who fills it, and very early on we realized we were very lucky to be making each other laugh. Between the cast and the crew and the production staff there were more than 100 people, and I’ll work with them again, but we’ll never have the exact same group doing the exact same thing, and that camaraderie is extremely special. You hope for it, but you don’t get it that often.”