David Barclay Moore has a unique gift. Not only does he remember his dreams and get story ideas from them but occasionally, he says, he can even guide his dreams. That ability gave him a key piece of what would become his debut novel, The Stars Beneath Our Feet (Knopf, Sept.).

“I had a dream that someone was building a whole city out of Legos, and I was able to stay with that for a while and envision what the city looked like,” Moore says. “When I woke up, I ran to my desk and jotted the whole thing down.”

That dreamy vision became the activity that keeps his main character, Wallace, going in the wake of his beloved older brother’s death in a gang shooting. The 12-year-old lives in Harlem with his mother and her girlfriend, a toy store employee who brings him big trash bags of Legos that the store has used in displays and no longer needs.

Moore grew up in Missouri—about 10 miles from Ferguson—but set his story along 125th Street, in a Manhattan neighborhood where boys must decide to join gangs for protection or make themselves targets by resisting. Wallace refuses, pouring his fertile imagination into creating an alternate city—Harmonee—built entirely out of Legos.

“I’m not a Lego person myself, but what I love about them is their creative capacity,” says Moore, who learned his way around Wallace’s neighborhood during the decade he spent as a communications coordinator for Harlem Children’s Zone. “Legos literally can become anything, and that is a metaphor for the choices Wallace has to make about who he can become.”

Though Moore has written plays, poetry, and essays, Stars is his first published novel. He wrote it after shopping a middle grade science fiction series to Steven Malk of Writers House, who took him on as a client on the strength of it, but encouraged him to try writing a more literary novel first. Stars took Moore about nine months to complete, but he feels as though he’d spent the previous decade getting ready to write it.

“I had written lots of manuscripts, including an adult novel that had a heavier Harlem vernacular but shared a lot of similarities with Stars,” Moore says. “That was like my training wheels.”

In December 2015, Malk sold the manuscript in a multibook deal to Nancy Siscoe at Knopf, whose offer bested three other houses. “It was fun to be able to meet with all these editors who really wanted my book,” Moore recalls.

He chose Siscoe because she told him she thought his manuscript was “98% done,” Moore recalls. “Being a writer, that sounded really good. There were other editors I met with and they had fairly dramatic changes in mind for the book, including having fewer characters. Nancy and I were very simpatico. The manuscript didn’t change dramatically, but the things she suggested really strengthened it.”

Next up for Moore is a screen adaptation of Stars, with the actor Michael B. Jordan signed to produce and direct. Moore, who studied film at Howard University and has made several documentaries, will write the screenplay and serve as executive producer.

“There was a part of me that actually looked forward to giving the story away,” Moore says. “I’ve had things adapted for stage and it’s always interesting to see the fresh perspective someone else brings to it. But in the end I wanted the challenge and to work with Michael.”

For the moment, though, Moore says he is enjoying success in his low-key way: “I have a fairly even keel about things, but after I got the book deal there were a few times I would just jump up in the air and pump my fist. People watching me probably thought there was something wrong with me. I’m usually not that excitable. But I realize I am very blessed, that it almost never happens like this.”