It depends. That seems to be a standard answer to a lot of questions on this forum, it depends, so bear with me a bit.
For thousands of years a standard model has been for a small farmer to keep a flock of chickens and raise replacements from the flock. Eventually they can run into genetic diversity issues so they bring in a new rooster. Different things control how often. One is what genes are in the flock to start with. If you have problems with them to start with it's best to get rid of them and start over. That's usually not a problem for someone starting like you.
How big is the flock and what is the make-up (hens to roosters). Random mating and hatching will assure some genetic diversity. The more you have breeding the longer you can go. Many hatcheries use the pen breeding system, they may have 20 roosters randomly mating with 200 hens. They can pretty much go forever and maintain enough genetic diversity as long as they don't breed defective chickens. You do need to keep an eye on that. You can go several generations longer with a flock with two roosters and 13 hens than you can with one rooster and five hens. I can't tell you how long though, that's going to depend on the randomness of which ones you keep.
Dad was one of those small farmers. He kept a free ranging flock of about 25 hens and one rooster. I can remember only two times that he brought in new blood in the time I grew up. That wasn't so much due to genetic diversity as that he wanted to improve the quality of his chickens. It would not surprise me if his flock was descended from the original chickens the pioneers brought to the frontier, a lot of game in them. Once he got New Hampshire chicks, another time Dominique, and kept one rooster from them.
Breeders use different methods that require careful recordkeeping and tightly controlling which chickens get to breed. That means breeding opens. I don't want to work that hard.