This question reflects a long-standing debate in origins-of-life research. Most evidence supports the RNA world hypothesis, which proposes that RNA came before both proteins and DNA, because RNA can both store genetic information (like DNA) and catalyze reactions (like proteins) through ribozymes. DNA is thought to have appeared later as a more stable repository of genetic information, while proteins subsequently became the primary catalysts due to their greater chemical versatility. Thus, RNA is generally considered to have come first, followed by proteins, and then DNA as a refinement of the system.
Nucleic acids are poorly suited for the role of prebiotic polymers. The monomers (nucleotides) have obviously a composite nature and therefore would hardly be as abundant as amino acids on the primeval Earth. Proper polymerization (without branching) in the absence of enzymatic catalysis is also problematic while amino acids can spontaneously form short oligomers through several mechanisms. I think, nucleotides (or rather nucleobases) came into the game as some kind of pigments, which protected protobionts from detrimental effects of UV radiation. Later, after switch of function, they could become involved in information storage and scaffolding. But the proteins were likely the first as biocatalysts and structural blocks. Probably, as oligopeptides and in combination with metal ions. Naturally, they were not coded by any genes but their sequence space was constrained by solubility, local availability of monomers, and presence of co-factors.
In the origin of life, RNA most likely came before both proteins and DNA, as proposed by the RNA World Hypothesis. Unlike proteins, which can catalyze reactions but cannot store genetic information, and DNA, which can store information but lacks catalytic function, RNA is uniquely capable of doing both. Evidence supporting this includes the fact that the ribosome, essential for protein synthesis, is an RNA-based enzyme, and many key biomolecules such as ATP are nucleotide derivatives. Thus, early life probably began with RNA molecules that acted as both genetic material and catalysts, later giving rise to proteins as more efficient enzymes and DNA as a more stable storage system.
I hardly can accept the theory that RNA was the first molecule. Anyone who has spent time handling RNA in the lab will understand what I mean. It is extremely difficult to keep RNA molecules intact without degradation even in vitro. Now imagine natural conditions, with constant exposure to UV light, high or fluctuating temperatures, changes in pH, acidity, and so on. How could RNA molecules survive in such an environment?