The modern thermodynamics of discrete systems is based on graph theory, which provides both algebraic methods to define observables and a geometric intuition of their meaning and role. However, because chemical reactions are usually many-to-many, chemical networks are rather described by hypergraphs, which lack a systematized algebraic treatment and a clear geometric intuition. Here we fill this gap by building fundamental bases of chemical cycles (encoding stationary behavior) and cocycles (encoding finite-time relaxation). We interpret them in terms of circulations and gradients on the hypergraph, and use them to properly identify nonequilibrium observables. As application, we unveil hidden symmetries in linear response and, within this regime, propose a reconstruction algorithm for large metabolic networks consistent with Kirchhoff's Voltage and Current Laws.