The Prambanan temple is the largest Hindu temple of ancient Java, and the first building was completed in the mid-9th century. It was likely started by Rakai Pikatan as the Hindu Sanjaya Dynasty's answer to the Buddhist Sailendra Dynasty's Borobudur and Sewu temples nearby. Historians suggest that the construction of Prambanan probably was meant to mark the return of the Hindu Sanjaya Dynasty to power in Central Java after almost a century of Buddhist Sailendra Dynasty domination. The construction of this massive Hindu temple signifies that the Medang court had shifted its patronage from Mahayana Buddhism to Shaivite Hinduism.
A temple was first built at the site around 850 CE by Rakai Pikatan and expanded extensively by King Lokapala and Balitung Maha Sambu the Sanjaya king of the Mataram Kingdom. According to the Shivagrha inscription of 856 CE, the temple was built to honour Lord Shiva, and its original name was Shiva-grha or Shiva-laya. According to the Shivagrha inscription, a public water project to change the course of a river near Shivagrha Temple was undertaken during the construction of the temple. The River, identified as the Opak River, now runs north to south on the western side of the Prambanan temple compound. Historians suggest that originally the river was curved further to the east and was deemed too near to the main temple.
The project was done by cutting the river along a north to the south axis along the outer wall of the Shivagrha Temple compound. The former river course was filled in and made a level to create a wider space for the temple expansion, the space for rows of pervara temples. Some archaeologists propose that the statue of Shiva in the garbhagriha of the main temple was modelled after King Balitung, serving as a depiction of his deified self after death.
The temple compound was expanded by successive Mataram kings, such as Daksa and Tulodong, with the addition of hundreds of perwara temples around the chief temple. Prambanan served as the royal temple of the Kingdom of Mataram, with most of the state's religious ceremonies and sacrifices being conducted there. At the height of the kingdom, scholars estimate that hundreds of brahmins with their disciples lived within the outer wall of the temple compound. The urban center and the court of Mataram were located nearby, somewhere in the Prambanan Plain.
The architecture of Prambanan temple follows the typical Hindu architecture traditions based on Vastu Shastra. The temple design incorporated mandala temple plan arrangements and also the typical high towering spires of Hindu temples. Prambanan was originally named Shivagrha and dedicated to the god Shiva. The temple was designed to mimic Meru, the holy mountain, the abode of Hindu gods, and the home of Shiva. The whole temple complex is a model of the Hindu universe according to Hindu cosmology and the layers of Loka. Just like Borobudur, Prambanan also recognises the hierarchy of the temple zones, spanned from the less holy to the holiest realms. Each Hindu and Buddhist concept has its own terms, but the concepts are essentially identical.
Either the compound site plan or the temple structure consists of three zones: Bhurloka, the lowest realm of common mortals; humans, animals also demons. Where humans are still bound by their lust, desire and unholy way of life. The outer courtyard and the foot part of each temple have symbolised the realm of bhurloka. Bhuvarloka, the middle realm of holy people, occupied by rishis, ascetics, and lesser gods. People here begin to see the light of truth.
The middle courtyard and the body of each temple symbolise the realm of bhuvarloka. Svarloka, the highest and holiest realm, reserved for the gods. Also known as svargaloka. The inner courtyard and the roof of each temple symbolise the realm of svarloka. The roof of Prambanan temples are adorned and crowned with ratna, the shape of Prambanan ratna took the altered form of vajra that represents diamonds. In ancient Java temple architecture, ratna is the Hindu counterpart of the Buddhist stupa and served as the temple's pinnacle. During the restoration, a well which contains a pripih was discovered under the center of the Shiva temple.
The main temple has a well 5.75 m deep in which a stone casket was found on top a pile of charcoal, earth, and remains of burned animal bones. Sheets of gold leaves with the inscription Varuna and Parvata were found here. The stone casket contained sheets of copper, charcoal, ashes, earth, 20 coins, jewels, glass, pieces of gold and silver leaves, seashells and 12 gold leaves. which was cut in the shapes of a turtle, Naga serpent, Padma, altar, and an egg