So he quit. He wanted to build something that, at market rate, would be affordable.

When Mr. Dishotsky first tried to get a bank loan for his new type of pared-down housing, he was turned away by 40 lenders.

“They were like, ‘Who would live this way?’” he said. “We’re like, ‘It’s everybody, it’s normal people you know.’”

A couple blocks away was the Ellis Street building, a former bathhouse turned into medical offices that became a vacant property. Another developer had tried to turn it into 11 luxury condos. Mr. Dishotsky’s pitch was 52 dorm rooms.

The move was both idealistic and practical. Because of arcane permitting rules and neighborhood associations that push against new developments, building new housing in San Francisco is painfully slow. But workers keep flooding the city, so roommates jam tighter into existing housing, already sharing bathrooms and renting living rooms as bedrooms. Mr. Dishotsky said he decided to build for what was already the city’s reality.

At the Ellis Street site, his team is digging down about a level and a half to make a basement lounge. Each floor has a communal kitchen for eight to 15 people. He’s working with his co-founder, Mohammad Sakrani, 30, on new beds that can be hoisted up and suspended from the ceiling during the day. They are also trying to design modular bathrooms and even entire bedrooms that can be “plugged in” to buildings.