The median one-bedroom apartment in San Francisco is something like $3,500 a month now. To keep that at 30% of gross income (which is still pretty bad), you need to be earning $140k a year. And yet, these graphs suggest that only "senior" engineers make $140k. And they top out soon after that (the "lead" roles are only making ~$160k).
If a company is asking you to move to the bay area, demand a salary that will allow you to live here without having to take roommates or go into debt. If not, make sure you're making a calculated gamble, and be sure you're getting some other concrete value for the financial sacrifices you're making -- career experience and reputation, for example.
If you're starting a startup in San Francisco...well, don't do it. Unless your customer base is here, you should go somewhere cheaper.