Used Coffee Bean Grounds

Just had an amazing idea to collect all my used coffee grounds and start my own little herb and vegetable garden, i also read that they can deter rats so i might be on to something