There are two reasons to not just going straight from the roaster into the grinder. First is about degassing, the second is more about taste.
Fresh out of the roaster coffee will throw off CO2 for a while. You can see for yourself that brewing super fresh coffee will “bloom,” that is puff up like a mushroom when hot water hits it. Allowing it to degas overnight will improve saturation of the grinds. What happens in bloom is that when the hot water hits the coffee, the gas is pushing out nearly as fast as the water is trying to get in, so you won’t be leeching out as much of that good flavor you want.
There are ways around this like more contact time with the water, as in a french press, but if you tend to do drip, you’ll see right away the effect of Bloom.
The second part of letting coffee sit around for a while, days, is kind of the same effect as leftovers. It may taste better. Some coffee is awesome the next day, while some likes to develop for a while. Examples would be simpler coffee like Costa Rica are good right away, vs complex coffees like many North African beans where four days might be the perfect spot for you.
You might think this is an argument for stale coffee but there’s a difference. Well kept, sealed coffee is one thing. However, it is not frozen in time, it continues to change. If you didn’t already see oil on the surface from roasting, after a few days or so you might begin to see oils on the surface. Your coffee may be reaching peak flavor the way you like it best in a day or 4 – 5 days.
The other side of a peak is a decline. At some point, your coffee is going to begin to stale. If you try to use your coffee up in a week or so, you should be fine. There ARE instances of holding back an espresso blend for a couple of weeks, but espresso is a whole different animal. Don’t worry, we’ll get there.
Going back to the idea of “How do I roast this?” is how long will I let this rest? How will I brew this? etc. It’s all related.