A portable electronic device having a) a folded substrate carrying components of the device, and b) another, separate component having a fixed outer contour, and c) a housing for enclosing said folded substrate and said separate component, said housing having an inner contour, wherein said folded substrate is folded from a planar substrate along a folding line, said folded substrate exhibiting outer edges comprising a folded edge following said folding line. A method of manufacturing a folded substrate. An object of the present application is to facilitate miniaturization of a portable electronic device, such as a hearing aid. A problem is solved in that the folded substrate is shaped to provide that at least one of said outer edges follow(s) the fixed outer contour of the separate component and/or the inner contour of said housing.