All afternoon, people lined up for Shelly Flash’s specialties: jerk cheese nachos and jerk chicken dinner tacos — that’s chicken, coconut rice, black beans, sweet plantains, pickled slaw, chipotle aioli and jerk sour cream inside a soft tortilla.

They were not disappointed.

The Jamaican taco business, 2 Girls & a Cookshop, is owned by Ms. Flash, 40, and her daughter, Jataun. Their fans (some of whom know Ms. Flash from the TV show “MasterChef”) find out where they will be selling her food on Instagram and via word of mouth, since the Flash family doesn’t yet have a restaurant of its own. Ms. Flash was a schoolteacher before the pandemic but last year decided to make food a full-time gig, she said. “I was just like, ‘What would it look like if I gave me a shot?’”

Ms. Flash and 27 other Black food vendors at the weekend’s Juneteenth Food Festival at the Weeksville Heritage Center in Brooklyn were actively fostering community at a time when many Black families have been leaving the city, drawn to regions where the cost of living is not as high and housing is more affordable. The city’s Black population has declined by nearly 200,000 people in the past two decades.

“I’ve lived in Brooklyn for 17 years now, and it’s just changed so much,” said DJ Monday Blue, who was playing a mix of house music, disco, Afrobeats and soul. Yet she saw so much positivity and hope in the gathering. “I love this organization, focusing on the businesses and the Black people that are here and saying, ‘Hey, we’re still here.’”

The food festival was organized by Black-Owned Brooklyn, an online publication documenting Black Brooklyn, and the vendors and customers were obviously passionate about delicious dishes. But all were also deeply appreciative of the bigger sense of connection — both to their neighbors and to their history.

All around the green space, framed by flowers and trees, friends and generations of families tasted various cuisines together: cornbread, lobster rolls and burgers, food from the Caribbean and Ethiopia, red food and drink to especially mark the holiday.

Nicole Kidd, 36, sat on the grass under a shade tree with her 8-year-old daughter, Miela Jones, and her mother-in-law, Patricia Jones. She had purchased lunch from the Greedi Vegan stall and was eating the dessert first: banana pudding.

Ms. Kidd, born and raised in Brooklyn, didn’t grow up knowing much about Juneteenth and its origins in Texas to mark the emancipation of enslaved African Americans. But, she said, “I’m excited that it is acknowledged now, and excited that it is celebrated.”

In addition, there was a sense of reverence for Weeksville, which was a town of free Black people, founded shortly after New York abolished slavery in 1827.

Weeksville was once home to about 700 families. It had a school, a church and a newspaper. Just three homes from the town, known as the Hunterfly Road Houses, still stand on the site. They are now city landmarks and have been added to the National Register of Historic Places.

It wasn’t Nkenge Walcott’s first time at Weeksville — she used to work at the school nearby. “We would often bring the kids here — they didn’t know how much history was in their own backyard,” she said.

Ms. Walcott, 28, was accompanied by her 16-year-old niece, Isis Hughes, who wanted Ethiopian food. Together, they sought out Makina Cafe’s bright yellow truck and ordered sambusa, a thin, flaky pastry stuffed with lentils, and tikel gomen, cabbage with carrots and potato in turmeric ginger sauce. Then Ms. Walcott headed over to GG’s Fish and Chips With Soul for golden-brown strips of fried catfish and washed it all down with a red hibiscus drink. “I’m supporting my Spelman sister who owns Brooklyn Tea,” Ms. Walcott said. “It’s really, really, really great iced tea.”

As the day wore on, visitors looked for sweets, lining up for mango popsicles from Island Pops and Caribbean vanilla ice cream from Crème and Cocoa Creamery.

But the true Juneteenth staple is red velvet cake.

Red foods, from strawberry soda to watermelon, are customary on Juneteenth, and Carmella Charrington, who was staffing the Doc’s Cake Shop tent, was briskly selling pieces of red velvet cake, strawberry cake and a special green, black and red Juneteenth cake.

Although Ms. Charrington, 52, had grown up in Brooklyn, it was her first time at Weeksville, and she was in awe of the site.

“I had to walk through and just say thank you to my ancestors,” she said. “We need to enjoy it, because that’s what they would want us to do.”