firebase basckend for stats; generously copied from https://www.firebase.com/tutorial