We propose the notion of Hopf module algebra and show that the projection onto the subspace of coinvariants is an idempotent Rota-Baxter operator of weight-1. We also provide a construction of Hopf module algebras by using Yetter-Drinfeld module algebras. As an application,we prove that the positive part of a quantum group admits idempotent Rota-Baxter algebra structures.