“The first thing Formula E did was come up with the track layout,” said Steven Grogg, senior vice president of McLaren. The route was largely in place already. “There were some minor changes to the track to minimize the impact on the cruise ship facilities.”

An immediate problem was that the terminal guardhouse was in the middle of the circuit. The solution was to rebuild it onto a removable plank, so that it could be moved before and after the race. Similarly, the firm replaced the parking lot’s gate arms with a prefabricated system that can be uprooted as needed.

Because the technology for e-cars is still evolving, batteries last only halfway through a Formula E race. The solution is to have a midrace pit stop allowing drivers to grab cars with fresh batteries.

Mitch Evans, who drives for the Panasonic Jaguar team, visited Red Hook two weeks before the race and is well aware of e-technology’s challenges. “You’re trying to go as quickly as you possibly can,” he said. “But you’re also trying to save energy while keeping the other cars behind you. I’ll cut the throttle going down the straight and then coast into the corner, so the energy I get from the brake goes back into the battery.”

The ePrix is a doubleheader, with races on Saturday and Sunday. Tickets cost $31 to $85. As for getting spectators in and out of the neighborhood, race officials are counting on public buses, Citi Bikes and the city’s new ferry service, which stops in Red Hook and Brooklyn Bridge Park. Formula E is also providing private shuttle buses to and from Barclays Center in Downtown Brooklyn.

For the drivers, the ePrix in Red Hook is one of the highlights of the season. Speaking by phone from Monaco, Nelson Piquet Jr., the driver for the NextEV NIO team, said, “New York City is such an amazing place and nobody’s managed to make a race there.” Mr. Piquet is a Brazilian who grew up mostly in Europe but lived in the United States for five years. “The amount of requests from friends and people that I know in America that want to see this race is insane,” he said. “Everyone is interested and intrigued about how it’s going to be in New York.”

Formula E intends to return to Red Hook every year. The organization has already signed a 10-year agreement with New York City to do so, although it will need to renew its permit annually.

Mr. Lewis of Baked hopes that people will discover Red Hook as the racing series goes forward. For the inaugural ePrix event in Brooklyn, his shop is catering private viewing parties, one of which will take place at 160 Imlay, the New York Dock Company building, which is in the process of a condominium conversion. “The party will be in one of the apartments that’s not finished yet, and it’s going to look out over the track,” he said. “It’s going to have amazing views. What else but Red Hook has the best views of the Statue of Liberty?”