Kerry Trueman and Matt Rosenberg began by growing tomatoes on the roof of their third-floor walk-up in the West Village more than 20 years ago.

“We didn’t know anything — we used Miracle-Gro,” said Ms. Trueman, 54, who blogs about the politics of food for Civil Eats and writes about climate change for Moms Clean Air Force. “But it changed the way I viewed things in cities. Whenever I was on a high floor, looking down, I would see all this roof space and say: ‘Wow, you could grow so much. There are no woodchucks or deer, no Japanese beetles. And so many things grow so well in containers.’ ”

They used a ladder to climb through the roof hatch then. They built large planters for strawberries and 20 different kinds of roses. They grew blueberries and corn and hops. They had to dismantle the roof garden in 1998 during a legal battle to keep their building rent-stabilized. But by then, they were hooked. “Tomatoes are the gateway drug,” Ms. Trueman said.

These days, their garden reincarnation resides in boxes that face south, east and north outside the windows of that same 450-square-foot apartment. At 4 ½ feet long by 1 ½ feet wide and deep, the containers are almost too big to call window boxes.