Abstract. In [GHK11], Conjecture 0.6, the first three authors conjectured that the ring of regular functions on a natural class of affine log Calabi-Yau varieties (those with maximal boundary) has a canonical vector space basis parameterized by the integral tropical points of the mirror. Further, the structure constants for the multiplication rule in this basis should be given by counting broken lines (certain combinatorial objects, morally the tropicalisations of holomorphic discs).Here we prove the conjecture in the case of cluster varieties, where the statement is a more precise form of the Fock-Goncharov dual basis conjecture, [FG06], Conjecture 4.3. In particular, under suitable hypotheses, for each Y the partial compactification of an affine cluster variety U given by allowing some frozen variables to vanish, we obtain canonical bases for H 0 (Y, O Y ) extending to a basis of H 0 (U, O U ). Each choice of seed canonically identifies the parameterizing sets of these bases with integral points in a polyhedral cone. These results specialize to basis results of combinatorial representation theory. For example, by considering the open double Bruhat cell U in the basic affine space Y we obtain a canonical basis of each irreducible representation of SL r , parameterized by a set which each choice of seed identifies with integral points of a lattice polytope. These bases and polytopes are all constructed essentially without representation theoretic considerations. Along the way, our methods prove a number of conjectures in cluster theory, including positivity of the Laurent phenomenon for cluster algebras of geometric type.