These notes constitute the first part of a detailed exposition of the theory of nilspaces developed by Camarena and Szegedy. We treat what can be called the algebraic part of the theory, in which nilspaces are studied without any topological assumption.