Covalent organic frameworks (COFs) are created by the condensation of molecular building blocks and nodes to form two-dimensional (2D) or three-dimensional (3D) crystalline frameworks. The diversity of molecular building blocks with different properties and functionalities and the large number of possible framework topologies open a vast space of possible welldefined porous architectures. Besides more classical applications of porous materials such as molecular absorption, separation, and catalytic conversions, interest in the optoelectronic properties of COFs has recently increased considerably. The electronic properties of both the molecular building blocks and their linkage chemistry can be controlled to tune photon absorption and emission, to create excitons and charge carriers, and to use these charge carriers in different applications such as photocatalysis, luminescence, chemical sensing, and photovoltaics. In this Perspective, we will discuss the relationship between the structural features of COFs and their optoelectronic properties, starting with the building blocks and their chemical connectivity, layer stacking in 2D COFs, control over defects and morphology including thin film synthesis, exploring the theoretical modeling of structural, electronic, and dynamic features of COFs, and discussing recent intriguing applications with a focus on photocatalysis and photoelectrochemistry. We conclude with some remarks about present challenges and future prospects of this powerful architectural paradigm.