Following the first principles, the elements of the analytic theory of potential curves for diatomic molecules (diatomics) are presented. It is based on matching the perturbation theory at small internuclear distances R and multipole expansion at large distances, modified by exponentially small terms for homonuclear case, with the addition of the phenomenologically described equilibrium configuration, if it exists. It leads to a new class of (generalised) rational potentials (modified by exponentially small terms) with a difference in degrees of polynomials in numerator and denominator equal to 4 (6) for positively charged (neutral) diatomics. For example, the He and LiH diatomics in Born–Oppenheimer approximation are considered. For He (He) diatomics it is found the approximate analytic expression for the potential energy curves (analytic PEC) for the ground state and the first excited state . It provides 3–4 s.d. correctly for distances a.u. with some irregularities for PEC at small distances (much are smaller than equilibrium distances) probably related to level (quasi)-crossings that may occur there. The analytic PEC for the ground state supports 829 (626) rovibrational states with 3–4 s.d. of accuracy in energy, which is only by 1 state less (more) than 830 (625) reported in the literature. The analytic PEC for the excited state supports all 9 reported weakly-bound rovibrational states. For LiH it is found the analytic expression for the ground state PEC in the form of a rational function, which supports 906 rovibrational states with 3–4 s.d. accuracy in energy, it is only of 5 states more than reported in the literature (901). For both diatomics, the difference in a number of rovibrational states is related to the non-existence/existence of weakly-bound states close to the threshold (to dissociation limit). Entire rovibrational spectra are found in a single calculation using the code based on the Lagrange mesh method.