How does Facebook really work? Read this story before you buy the stock.

From Fortune:

FORTUNE — On a Friday morning not long ago, Mark Zuckerberg gathered his troops for a much-anticipated all-hands meeting at Facebook’s brand-new headquarters. It was billed as a not-to-be-missed event. Employees who were traveling were encouraged to return to the mother ship, and those in New York, Dublin, Hyderabad, and other satellite offices were told to watch via live stream. In Menlo Park, Calif., some 2,000 employees marched into a large white tent that was set up for big gatherings on a lawn across from the parking lot. The mood was effervescent, or as one employee described it, “part religious revival.” The pre-meeting buzz had people betting that Zuckerberg was finally ready to discuss the momentous event that would transform the eight-year-old company from hot startup into card-carrying member of the business establishment: Facebook’s IPO.

Zuckerberg had other plans. He mentioned the IPO only in passing. This was a gathering to discuss priorities for 2012, according to employees. In a sense, the purpose of the meeting was to remind everyone to stay on course even as Facebook prepared to undergo its biggest change yet. No matter what happens on the outside, Zuckerberg told employees, keep your heads down. “Stay focused,” he urged. “Keep shipping.” Twelve days after the January staff meeting, Facebook announced its plans to go public.

The 27-year-old co-founder and CEO has always displayed an almost preternatural ability to forge ahead with his lofty ambitions — to make the world a more open and connected place — even amid major distractions such as, oh, the release of an unflattering, Oscar-winning biopic. That sense of mission, coupled with a hard-charging, engineering-driven culture with Zuck himself at the center of it all, has propelled the company’s torrid growth: Today nearly one in every eight people on the planet uses Facebook. The site is transforming giant sectors of the economy, such as entertainment, media, and retail. What began eight years ago as a half-dozen overcaffeinated coders has morphed into a giant with 3,200 employees worldwide; its new campus alone will be able to eventually house nearly 10,000 workers.

Ever since he hatched the social network in his Harvard dorm room in 2004, Zuckerberg has fought to preserve the so-called hacker ethos that is at the root of how Facebook really operates. He’s largely succeeded: Facebook remains a place where engineers stay up all night to mock up new features. It’s a place where managers will scrap the site’s most sacred elements, like the traditional profile page, if there’s a potential for something better. It’s a place where the best ideas become products whether they were dreamed up by a lowly intern or Zuck himself. It’s a place where everyone takes to heart the dictates written on posters plastered all over campus: DONE IS BETTER THAN PERFECT and MOVE FAST. BREAK THINGS.

No one has written a management playbook for a company that is redefining the web while growing at warp speed. This story offers a rare glimpse inside Facebook, a company that has designed a set of rules for how to cultivate its own brand of chaos. Facebook declined to make top officials available, but conversations with several senior managers and dozens of additional interviews with current and former employees and executives paint a rich picture of a truly unconventional workplace. You’ll read how Facebook holds bootcamps to teach engineers to “think like Zuck,” forces people to change projects midstream, and even mandates all-nighters. And how this unusual approach has led to some of Facebook’s most important product developments, such as Timeline and Chat. It is also the canon that Facebook is trying hardest to impose on its more traditional businesses and marketing operations.

Facebook’s forthcoming IPO will cement Zuckerberg’s status as one of Silicon Valley’s iconic entrepreneurs alongside the likes of Bill Hewlett and David Packard, Larry Page and Sergey Brin, and even Steve Jobs. It will propel Facebook into the top echelons of corporate America, make multimillionaires out of hundreds of its employees, and give the company the financial might to go toe-to-toe with giants like Google (GOOG), Amazon (AMZN), or Apple (AAPL). But becoming a publicly traded company may be the biggest threat to the culture of reinvention that has made Facebook a success thus far. Countless other startups were so transformed by their IPOs, through the pressures of quarterly earnings, the sudden employee wealth, and the sheer size, that they lost their edge.

What’s more, Facebook itself has already faced cultural challenges. Most notably, this is a company that operates as two symbiotic halves. One, Zuckerberg’s world, is a meritocratic, coder-led organization that develops the Facebook site; the other, which is charged with making money out of it, is subordinate. It is more hierarchical and corporate and is the domain of Zuckerberg’s handpicked deputy, Sheryl Sandberg. The arrival of Sandberg, a former Google executive, in 2008 was widely seen as a sign that Facebook was growing up, and hiring her by all accounts was a smart and much-needed move. Yet as the importance of the business side grows once Facebook goes public, the inherent tension between the two is certain to be magnified under the glare of Wall Street. It all amounts to the paradox that on the eve of its IPO, Facebook is a powerhouse, yet it feels a bit fragile.

And so, inside Facebook, executives are consciously working to codify its winning formula — essentially institutionalizing a sort of anarchic mentality — even as the company is about to be handed a very thick rule book from the SEC. They are creating training programs and communications tools (using Facebook, of course) that keep the company as lean and as fearless as a startup. After all, Facebook’s growth depends on the company’s adding new services and wooing new users without losing the attention of its existing 843 million users. So there’s no doubt an IPO will change Facebook. The question is, Will insane growth, market demands, and internal tensions hitting the company all at once chip away at its essence and spirit? Or will Zuck and his team navigate the turbulence successfully and emerge with a strengthened Facebook Way?

Continue reading the rest of the story on Fortune