Superpotential algebras and Calabi-Yau categories