Last Saturday night, when all of New York City’s bars and clubs were closed, DJ Physical Therapy set up a turntable, mixer and webcam in his walk-up apartment in the Ridgewood section of Queens.

Wearing a Hawaiian T-shirt and track pants, and standing in his cramped bedroom stuffed with records and sneakers, he live-streamed a two-hour set of house music and booty bass tracks to about 11,000 virtual clubgoers, some likely wearing pajamas at home.

Though the new coronavirus has halted the city’s nightlife, club owners and D.J.s have shown a lot of ingenuity in coping and collaborating. Some clubs are hosting live D.J. sets on Instagram and Facebook. Piano bars are live streaming their favorite singers. Party promoters are hosting Zoom dance parties and playing sets for friends and family over Twitch.

And out-of-work D.J.s are enlisting social media to communicate with their fans and generate income.

Justin Carter and Eamon Harkin, the owners of Nowadays, sprang into action on March 12, when President Trump banned travel to Europe. They teamed up with Francois Vaxelaire, the owner of the Lot Radio to create Virtually Nowadays, which has been streaming D.J. sets every night from 8 p.m. to midnight.

The show takes place in different apartments and is free, though fans can support the D.J.s through Patreon starting at $5 a month. “Just because Nowadays has shut down doesn’t mean they don’t exist anymore,” Mr. Vaxelaire said.

Other clubs have joined the live-streaming party. Kae Burke and Anya Sapozhnikova, the founders of House of Yes, a performance club in the Bushwick section of Brooklyn, hosted a virtual dance party last Saturday night on Zoom, the video chat app.

In keeping with the club’s vibe, festive costumes were required and attendance was capped at 100. “It was surprisingly uplifting and emotional,” Ms. Burke said. “We will be doing it again this Saturday.”

Resident performers and D.J.s at Club Cumming, a cozy bar and event space in the East Village, are keeping the club’s schedule afloat online. Rod Thomas (better known by his D.J. name, Bright, Light, Bright Light) is streaming his popular, 1980s-themed tea dance on Saturday afternoons via Facebook.

Homebound D.J.s are also hosting virtual house parties. Amber Valentine, a D.J. at the Woods, an outdoorsy bar in the Williamsburg neighborhood of Brooklyn, turned her tidy white apartment into a ’70s disco pad last Sunday, with red paper lanterns and multicolored lights, and played obscure disco and funk from 9 p.m. to 11 p.m.

Like any good hostess, she wore a sparkly off-the shoulder dress and greeted people by name as they joined the party on Instagram Live. Her guests responded in kind. “Best Sunday night ever,” wrote Masanni Hosono, a creative director at a gender-neutral hair salon in the East Village. Folding laundry and ”booty grooving,” said another user, named Bevin.

Others have sought refuge in show tunes. Marie’s Crisis, the beloved piano bar in Greenwich Village, opened its private Facebook group so anyone can listen to its favorite performers belt out Sondheim classics. The group has added more than 10,000 members since last week.

Some nightlife veterans have decided that this is the moment to do a little housekeeping and release archives as a way to make money. The CarryNation, a D.J. duo in New York that hosts queer dance parties, created a Patreon page and is charging $10 a month for access to their previously unreleased live recordings and house remixes.

Underlying this creative burst is the troubling reality that much of the city’s nightlife community will be without a steady stream of income for the foreseeable future. Last week, the New York City Office of Nightlife posted an online survey for nightlife workers to assess the economic effect of the coronavirus pandemic. It has received more than 10,000 responses (the survey closes on March 27).

The situation is particularly dire for the part-time workers who live paycheck to paycheck. Some bars and clubs are trying to help.

Nowadays set up a Venmo account for its staff and has raised $22,000. House of Yes has raised $29,907 on GoFundMe. And a new party called Social Disdance, which takes place exclusively on Zoom, encourages fans to send money to its D.J.s and coronavirus-related charities.

DJ AvJo, who played for one hour on Zoom last Friday night, said he made $300, about the same amount he got from traditional four-hour gigs.

“Plus, I usually have to take a cab to the location there and back,” he said. “It was so uplifting. It really felt like we are all in this together.”