Freshly-roasted coffee is about as sensitive as a liberal-arts freshman at UC Berkeley. You need to treat it just right in order for it do what you want it to do. There are plenty of myths about the proper ways to store coffee, most perpetuated by mother-in-law wisdom passed along from the days of freeze-dried Maxwell House. A couple of reminders about the molecular structure of freshly roasted coffee helps to decide what is best for proper storage.
To summarize: The four enemies of whole bean coffee are heat, light, water, and air.
Coffee is hygroscopic. That means that it will absorb water from the air. It can also absorb odors and flavors carried by that water. Neither of these lends to enjoying the coffee as it was meant by the roaster. When coffee absorbs water, it displaces the essential oils in the coffee and accelerates aging.
Second, fresh-roasted coffee expels a lot of CO2. It's a natural byproduct of the roasting process. The key to keeping coffee fresh longest is allowing CO2 to leave while preventing oxidation. Oxidation accelerates with more surface area so ground coffee will oxidize much faster than whole bean.
Coffee is a food product. Food likes cool, dark places to stay fresh. Just like freshly baked bread, if coffee is left out in the sun, it will go stale very fast.
It's pretty, but it's not the best way to store coffee. Keep it out of the sunlight.
Lastly, coffee loves heat when it's ready to brew, dissolving the flavor compounds and oils in the grounds into a delicious drink. However, if it is exposed to heat before brewing, it will start to break down and lose that punchy flavor.
So - now let's dispel the myths:
- Don't store coffee in the freezer. It's a moist and smelly place. Coffee will pick up all of that moisture and smell. Further, it has not been proven to extend the life of the coffee, but freeze/thaw cycles have been proven to introduce moisture. Recent research has suggested that colder beans will grind more uniformly, but trying to control humidity outside of the lab seems like a big gamble for the home enthusiast.
- Airtight containers are better than nothing. However, the Airscape containers are better, and vacuum sealed canisters like Fellow's Atmos are best. Both actively remove excess air from the container. The Airscape does this with a plunging lid and the Fellow Atmos with a built-in piston that manually forces air out creating a vacuum.
- Roasters (generally) know what they are doing with packaging. Most of our favorite roasters: Onyx, Verve and Greater Goods package their coffee in nitrogen flushed valved bags. This is the absolute best way to store coffee. So, buy smaller bags and keep them sealed until you are ready to use.
- Don't drink freshly roasted coffee. Sure, it's OK for pour-over 24 to 48 hours after roast. However, the pressurized environments of espresso need some sitting. Let it rest for 4-6 days after roast. The off-gassing of C02 will allow the flavors to come through.