The Treasury of Mysteries is the first large-scale work by Nizami Ganjavi. Considered one of the most valuable examples of the didactic poem genre in the literature of the Near and Middle East, the work was also the poet’s first major experiment in the field of epic poetry. The poem was written in the year 570 according to the Hijri calendar, corresponding to 1174–1175 in the Gregorian calendar.

At first glance, The Treasury of Mysteries belongs to the tradition of didactic works that had been widespread in Near and Middle Eastern literature before Nizami. In terms of its themes and purpose, it bears a certain resemblance to works such as Kalila and Dimna, Kutadgu Bilig, Hadiqat al-Haqiqa, Siyasatnama, Qabusnama, Chahar Maqala, and others. At the same time, however, The Treasury of Mysteries differs from these works in important ways. Nizami appears to have brought the didactic literary tradition that preceded him to a culmination and given it a more elevated humanistic and democratic direction.

The poem consists of a preface devoted to various subjects, a series of discourses, and short stories that illustrate these discourses through vivid epic scenes. The poem concludes with a brief section concerning the completion of the book.

At the beginning, under the headings Tawhid, Munajat, and Na't, the poet speaks of God and the Prophet, praising them within the framework of Islamic religious doctrine. Yet, responding to the demands of his time, the poet addresses serious social problems even within these sections, although he does so through traditional religious expressions. Nizami’s artistic position toward these issues is particularly striking: the poet emotionally engages the reader, and his own state of mind and inner turmoil are conveyed to the audience. It becomes clear that all these praises and invocations are, in fact, a pretext for moving toward the central subject of the work.

Deeply dissatisfied with the conditions of his age, the poet appeals to God and the Prophet in the name of great ideals. He calls for the restoration of an age of ancient justice, truth, and purity, recalling the way of life associated with the early years of Islam.

Nizami’s political, social, and moral ideas concerning a just human society are presented in scattered form throughout The Treasury of Mysteries, his first major work combining epic and lyrical elements. They appear in the preface and in twenty discourses, each of which can be regarded as a complete artistic work in its own right. Despite this seemingly fragmented structure, the themes and ideas presented in the twenty principal discourses and the artistic preface are logically interconnected and collectively express the unified theme and central idea of the poem.

Themes such as social labor, the moral qualities of members of the higher and lower classes, and the role of poetry and the poet in the construction of society all serve the broader purpose of illuminating Nizami’s central concern: his vision of a just human society.

Hamid Arasli notes that the principal themes and ideas of The Treasury of Mysteries are justice and labor, and that the important social, political, and moral issues of Nizami’s era are reflected throughout the work.

When discussing the theme of The Treasury of Mysteries, Yevgeny Bertels emphasizes that the poem is grounded in the poet’s reflections on justice and labor, as well as moral principles such as keeping one’s word, showing compassion, rejecting the pursuit of gold, and valuing true friendship.

F. Gasimzade, meanwhile, argues that the themes and ideas presented in the individual discourses of The Treasury of Mysteries can largely be analyzed under three principal categories: justice, labor, and morality.