Showtime has a new series starting Sunday called “I’m Dying Up Here.” It’s based on William Knoedelseder’s 2006 non-fiction book about the Los Angeles comedy scene in the late 1970s, particularly at the Comedy Store, where young comics like Jay Leno, David Letterman, Jimmy Walker, Robin Williams, Tom Dreeson, and dozens of other standups were trying to get noticed.

The TV show is based at Goldie’s, a club run by a woman very much like Mitzi Shore, who ran The Comedy Store. She’s played by Melissa Leo — in an Emmy-worthy performance — as not just a businesswoman but also the gatekeeper and mentor for the young comedians working on her stages and hanging around her bar. Ari Graynor really stands out as Cassie, the sole woman among the core group of comics, who’s trying to emulate Elayne Boosler, the breakout female comedian of the era.

The show not only references Boosler and her contemporaries, but has actors playing Richard Pryor, Sonny Bono, Wolfman Jack (then the host of NBC’s “Midnight Special”), and other real people from that time. Thanks to executive producer Jim Carrey, it gets the tone right, from the comics who spend hours at the club every night just to get a few minutes of stage time to work on their material, to the need for day jobs to create income since Mitzi/Goldie didn’t pay them, to the desperate hope to be discovered on Johnny Carson’s show (he’s played by Dylan Baker) and given a sitcom a la Freddie Prinze.

The show does have a slight problem with actors-playing-standups syndrome, but it’s not as pronounced as it was in other projects like “The Comedian” and “Punchline.” Part of the explanation may be the presence of Carrey and a few other comics who were part of that scene in the late seventies and eighties (including Dom Irrera, Cathy Ladman, and Rick Overton), as well as “Daily Show” regular Al Madrigal.

But it’s Leo that steals every scene she’s in and makes “I’m Dying Up Here” well worth your time.