The coffee plant (Coffea arabica) didn’t evolve the capacity to produce caffeine just to help humans keep their eyes open through a boring day at work, but rather as an insecticide. En effect, insects that try to eat a coffee plant will quickly be paralyzed by the caffeine and other toxic products it contains and may even die.
Sadly for coffee-drinking gardeners, watering your plants with coffee will not repel insects: caffeine decomposes too quickly to be effective, plus it is also slightly toxic to roots and beneficial soil fungi. Thus you wouldn’t really want to water your plants with coffee.
However, you can put coffee grounds in the compost and later apply it to your plants. Once they have decomposed, coffee grounds are beneficial to plants, enriching the soil in minerals.
Beware, however: despite plenty of claims to the contrary, the coffee grounds are not a miracle product, but simply an organic waste that decomposes over time as do so many others. Read more about it here: The Truth About Coffee Grounds.