However, there are a bunch of startups actually in San Francisco, Uber and AirBnB being ones that get a lot of airtime, and Twitter (which is no longer a startup). There are lots and lots of pre-revenue 2 - 15 employee companies there as well. YCombinator is in Mountain View which is right next to Sunnyvale, and about 36 miles from San Francisco.
San Francisco is urban and hip and all of that, and a lot of people want to live there. Then they take bespoke busses and ride down the peninsula to places in the "south bay" (the collective term for the communities at the southern end of San Francisco bay). That is part of the issue that SF residents have, which is people who live in SF but work somewhere else, they are able to pay higher prices and the bus eliminates the commute disincentive.
On either side of the bay between these two loci are a number of vibrant and interesting places as well, on the west side you have the peninsula cities of Burlingame, San Mateo, Redwood City, San Carlos, and on the eastern side you have Oakland, Hayward, Berkeley, and Richmond.
Somewhat remarkably they have their own micro-climates so you get different weather depending on where you are.
Cities in the north and on the east of the bay have BART service, cities on the south and west of the bay have CalTrain service. There are three major airports one east (Oakland), one south (San Jose), and one west (SFO). Efforts to turn Hamilton Air Force base in Marin county into a northern airport have been rebuffed several times.
If you are not working at a company that is actually located in San Francisco you will have a shorter/easier commute if you live outside of San Francisco (typically on the east or west side of the bay that your company is on). You will also pay less for an apartment/house.
[1] Which is nominally the Santa Clara Valley where all of the semiconductor companies were located.