The optimal design of grid-connected distributed energy systems (DES) has been previously investigated, but most studies exclude nonlinear multiphase optimal power flow (MOPF) constraints which capture imbalances in alternating current (AC) distribution networks. Previous DES design studies considering AC power flow assume balanced loads and networks, which is an assumption that does not hold for distribution networks that are often inherently unbalanced. This is the first study to present an optimisation framework for designing grid-connected DES while simultaneously considering multiphase optimal power flow (MOPF) constraints to accurately represent unbalanced low-voltage distribution. This study proposes a new algorithm for obtaining DES designs subject to nonlinear multiphase power flow constraints with regularised complementarity reformulations for operational constraints containing binary variables. DES design models with either MOPF or OPF are tested using an unbalanced distribution network, where rooftop solar, gas boilers, and battery storage are considered as distributed resources. Despite the increased complexity, DES design with MOPF obtains the best solution, with 81% greater solar capacity and 6% lower total annualised cost when compared to DES with OPF. Designs from a commonly-used linear DES design framework based on direct current (DC) approximations produce the highest costs (8% more than initially predicted) when tested with MOPF. The proposed algorithm with complementarity reformulations achieves a 19% improvement in the objective value over a previous two-stage decomposition for DES with OPF, where the entire binary topology in the nonlinear model is fixed. The study therefore enables the acquisition of DES designs that can work symbiotically within unbalanced distribution networks.