Housing needs to meet height width style and background wall criteria for NPC spawning.
Use the Housing Query tool to check eligibility before building.
Each NPC has biome and neighbor preferences so use planters and biome sensors to funnel them.
Keep each dwelling fully enclosed with at least one light source and furniture piece.