The present paper presents a framework for holistic optimization of monopile foundations for a full offshore windfarm. The framework has been developed in-house at Wood Thilsted Partners and has been used for design of several full-scale wind farms including Vineyard Wind, the first commercial scale wind farm in the US. The backbone of the code is a beam finite-element based structural analysis code that performs all necessary design checks according to the governing standards. A direct coupling to various 3D FE-software packages is in place for detailed analyses of non-trivial structural details such as bolted flange connections and welded attachments. Three dimensional FE is also used for position-specific 3D soil analysis for calibration and validation of the non-linear soil-structure interaction springs serving as boundary conditions for the model. Installation and drivability assessments are similarly included in the design flow based on the beam model and validated subsequently via parameterized 3D models. Everything is integrated in a fully automated optimization framework that can perform a full optimization sweep including automatic generation of design reports and drawing material ready for certification for a full windfarm of several hundred individual positions in a few hours. Representative examples illustrate how the framework provides the possibility for conducting large scale sensitivity studies, such as diameter and clustering studies allowing for holistic cost-optimization across all positions in a windfarm.