Over the past 25 years, the field of evolutionary developmental biology (evo–devo) has used genomics and genetics to gain insight on the developmental mechanisms underlying the evolution of morphological diversity of animals. Evo–devo exploits the key insight that conserved toolkits of development (e.g. Hox genes) are used in animals to produce genetic novelties that provide adaptation to a new environment. Like development, immunity is forged by interactions with the environment, namely the microbial world. Yet, when it comes to the study of immune defence mechanisms in invertebrates, interest primarily focuses on evolutionarily conserved molecules also present in humans. Here, focusing on antiviral immunity, we argue that immune genes not conserved in humans represent an unexplored resource for the discovery of new antiviral strategies. We review recent findings on the cGAS-STING pathway and explain how cyclic dinucleotides produced by cGAS-like receptors may be used to investigate the portfolio of antiviral genes in a broad range of species. This will set the stage for evo–immuno approaches, exploiting the investment in antiviral defences made by metazoans over hundreds of millions of years of evolution. This article is part of the theme issue ‘Sculpting the microbiome: how host factors determine and respond to microbial colonization’.