Fibroblasts are activated to repair the heart following injury. Fibroblast activation in the mammalian heart leads to a permanent fibrotic scar that impairs cardiac function. In other organisms, such as zebrafish, cardiac injury is followed by transient fibrosis and scar-free regeneration. The mechanisms that drive scarring versus scar-free regeneration are not well understood. Here, we show that the homeobox-containing transcription factor Prrx1b is required for scar-free regeneration of the zebrafish heart as the loss of Prrx1b results in excessive fibrosis and impaired cardiomyocyte proliferation. Through lineage tracing and single-cell RNA sequencing, we find that Prrx1b is activated in epicardial-derived cells where it restricts TGFβ ligand expression and collagen production. Furthermore, through combined in vitro experiments in human fetal epicardial-derived cells and in vivo rescue experiments in zebrafish, we conclude that Prrx1 stimulates Nrg1 expression and promotes cardiomyocyte proliferation. Collectively, these results indicate that Prrx1 is a key transcription factor that balances fibrosis and regeneration in the injured zebrafish heart. This article has an associated 'The people behind the papers' interview.