Download Facebook Source Code
Have you ever considered to setup a site similar to Facebook? Now Facebook has released the source code for developers with the name Facebook Open Platform. Facebook Open Platform is a snapshot of the infrastructure that runs Facebook Platform. It includes the API infrastructure, the FBML parser, the FQL parser, and FBJS, as well as implementations of many common methods and tags.
It is released under Common Public Attribution License *. It is not like GPL which means not completely free due to following part in the license text:-
[…] the Original Developer may include […] a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run […] a prominent display of the Original Developer’s Attribution Information […] must occur on the graphic user interface employed by the end user to access such Covered Code […]
You can download Facebook Source Code from here.You can see Facebook General Data Model below. The Data model looks like the following. Click on the picture to see the data model in larger detail.

* Common Public Attribution License: The Common Public Attribution License (”CPAL“) is a free software license approved by the Open Source Initiative in 2007.[1] Its purpose is to be a general license for software distributed over a network. It is based on the Mozilla Public License, but it adds a controversial attribution term paraphrased below:
You can access the details of Common Public Attribution License Version 1.0 from here.