The process of modifying metabolic pathways in microorganisms or cells to optimize the production of desired compounds.