Tutorials/Iron golem farming

Iron golem farming uses village mechanics to produce iron, as well as byproducts such as poppies and string. Usually, an iron golem farm is a player-constructed village in which golems are spawned and then either killed immediately, or moved to a holding cell outside the village boundary for later killing.

Java Edition
In Java Edition, a villager may attempt to spawn an iron golem after "talking" to 10 other villagers. The villagers must have access to their workspace and have slept before the golem will spawn, however.

Java Edition iron farm mechanics
Iron golems can spawn when non-nitwit villagers who have slept in beds gossip five times about needing a golem at a gathering point, and four other villagers are within 80 blocks. Once these conditions are met, an iron golem can spawn in a 16×6×16 area centered on the location of the villager who spread the gossip.

Bedrock Edition
In Bedrock Edition, villagers are not required to sleep or have a workstation in order to spawn iron golems. For an iron golem to spawn, the following conditions must be met:
 * The village has at least 21 beds
 * The village has at least 10 villagers, each of whom has claimed a bed
 * The villagers can interact with one another

Bedrock Edition iron farm mechanics
The golem, being nearly 3 blocks tall, needs sufficient air space above the foot to allow it to move.

Beds placed 3 or more blocks above ground will cause iron golems to spawn on a platform within the spawning region, and not on the ground.

Avomance's Compact Iron Farm 1.14
Expandable, Low Lag & Survival Friendly