One of the built-in hooks of the biopic is that it tends to involve fame and fortune. Even if the person in question winds up descending from fame and squandering the fortune, tumbling into addiction and falling from grace, at least he or she had their moment in the sun. Part of the genre’s allure is that we get to revel in that moment. That’s why the hardscrabble hip-hop biopic “Roxanne Roxanne” is in a category all its own.

The movie tells the story of Roxanne Shanté (née Lolita Shanté Gooden), the girl rapper from the Queensbridge projects who in 1984, at the age of 14, recorded (in one tossed-off take) “Roxanne’s Revenge,” an answer record to U.T.F.O.’s “Roxanne, Roxanne” that quickly became an epochal underground single. The original U.T.F.O. track dissed a girl named Roxanne for being cold and hard to get. But Roxanne Shanté’s answer track wasn’t just defiant — it was epic. It was relentless. With nothing but a drum track behind her, she went on and on and on, in the raggedly possessed voice of a feminist teenage street queen (“Every time that he sees me, he says a rhyme,/But, see, compared to me, it’s weak compared to mine”), and within the hyper-masculine world of hip-hop, it was as if she was inventing a new way for a young woman to be.

No wonder “Roxanne’s Revenge” set off a musical earthquake. The single sold 250,000 copies, but over the next two years, other MCs got into the act, producing nearly 50 12-inch singles that volleyed back and forth in response to the original Roxanne rivalry. The “Roxanne Wars” became an iconic chapter in the evolution of hip-hop, demonstrating not just its commercial potential but its viral power. If Chuck D, of Public Enemy, would later say that “Rap is black America’s CNN,” in the Roxanne Wars rap was social media: a virtual dialogue. It all happened because Roxanne Shanté rapped out her raw teen fury and connected to the world. But here’s the thing: She had no record company (though Warner Bros. flirted with her), no royalties, no populist glamour, no elevation. Even after the song became famous, she was still just a girl in the projects, struggling to get by. And that’s the story told by writer-director Michael Larnell in “Roxanne Roxanne.” He has made a skillful and ironically gripping coming-of-age movie: a hip-hop anti-biopic.

For a long time, every rap artist worth his or her salt had to have (or manufacture) street cred, which meant two things: They were tough enough to have danger — violence — in their blood; and they knew the double agony of racism and poverty. Hip-hop biopics from the terrific “Notorious” to the overrated, TV-movie-sketchy “Straight Outta Compton” have all had that element, but “Roxanne Roxanne” is a drama about the inner reality of street cred, which isn’t about moving dope or dropping dimes or pointing AKs. It’s about waking up each day to a neighborhood of no hope.

That happens to Shanté even once her novelty song gets famous. The movie opens in 1982, when she’s just 12, competing in impromptu public-park battle raps to make a few bucks. “Roxanne Roxanne” doesn’t overdo the period paraphernalia the way ’80s nostalgia movies usually do. Larnell’s flowing, visually vibrant filmmaking catches the popping optimism of the time, a spirit that was there even in the hood, where the graffiti glowed and the DJs and MCs knew (they really knew) that they were inventing the music of the future. Shanté is into fashion, of course — she and her friend mention those Sergio Valente Jelly Bean jackets — and then the movie leaps ahead a couple of years, to when she’s a teenage shoplifter in braces who still sucks her thumb. She’s now played by the remarkable Chanté Adams, who shows you the little girl inside and the sandpaper-tough hoodlum that conceals her.

And with good reason: It’s a harsh life. Shanté’s mother, Peggy (Nia Long), is a stern customer who locks the door at 9:00 p.m., even if her daughter is locked outside, but only because she’s trying to look out for her. When Peggy lands a seemingly nice fellow (Curtiss Cook) she loves and trusts, she talks about moving out of the projects and into a house, and she presents him with her life savings of $20,000 (a fair amount of money in 1984). As soon as we see the dirty wadded bills, we think, “Uh-oh.” The boyfriend, and the cash, soon disappear in tandem.

It’s a tragedy that will be echoed in Shanté’s own bad choice of men, though not before she records the song that takes over the airwaves. We’ve seen her rap, here and there, on the sidewalk, and this is the rare hip-hop movie that understands how the ferocity of freestyle erupts out of a brain that’s humming and a soul that just doesn’t give a f—-. Shanté is a natural. The recording of “Roxanne’s Revenge,” a fabled moment in hip-hip history, occurs quite incidentally, when Marley (Kevin Phillips), an aspiring record producer, calls down to Shanté from an upstairs window. It’s his idea to have her record an answer track to “Roxanne, Roxanne” (in truth, a rather bombastic song), but the deliriously extended rap is all Shanté’s. It’s mesmerizing, and when she’s done, she scurries out of there, because she has to get back to her laundry.

Our heroine, now known as Roxanne Shanté, doesn’t land a record deal and doesn’t make much money. But since hip-hop had already entered its crossover phase (Grandmaster Flash and the Furious Five’s “The Message” — a.k.a. the rap song that was universal enough in its alienation for white people to like — had come out two years earlier), it’s never totally explained why record companies aren’t lining up at her door. Shanté hasn’t just put out a single; she’s brought the news. That’s part of why she gets left behind — the news is bigger than she is.

She does get to perform, appearing on stage with Biz Markie, but she burns through her tour money, and that proves to be a problem once she gets lured into a romance with Cross (Mahershala Ali), a handsome local hustler with a pimp’s cold duplicity. Basically, he’s preying on a child (he buys her a white mink coat), but he’s sweet as pie…until he isn’t. If Ali, in “Moonlight,” endowed a drug dealer with singular complexity, here he channels the inner torment of an abuser. There’s a startling piece of editing in which Shanté, viewed from the same vertical camera angle, goes from screaming during sex to screaming during childbirth to screaming as Cross drags her across the floor by her hair. The descent of the relationship happens in 10 seconds, but Ali, tender and scary, never cheapens the character’s villainy. “You’re too pretty not to be smiling,” says a photographer to Shanté during a photo shoot. “I can’t move my fucking jaw,” she replies.

The heroine of “Precious” dreamed of becoming a star. In “Roxanne Roxanne,” the heroine becomes a star — and remains nearly as trapped in the prison of her life as the heroine of “Precious.” Yet there’s a redemption: She will do anything short of selling her soul to keep her child, and in the end, when she does, she finds her life. You can’t really say that “Roxanne Roxanne” is “an exhilarating hip-hop fable.” But it’s a vivid and unusually honest drama about the pain and bravado that were the fuel of hip-hop. Now more than ever, there should be a market for a movie about growing up in an American hell and coming out the other side, through the gift of the word.