Air, light, heat, and humidity. These four strip coffee of its taste fast, so everything starts with keeping them away.
Once you open the bag, move the coffee into an airtight jar. If you keep it in the bag, close it very tightly after every use.
Keep the jar in a kitchen cabinet away from the stove and the window. No fridge needed: taking it in and out exposes the coffee to moisture and other smells.
Coffee tastes best soon after the bag is opened. Buy an amount that lasts you two to three weeks, not months.
If you grind at home, grind only what the cup you are making needs. Ground coffee loses its taste much faster than whole beans.
Next: how to get the best taste out of your cup