You can follow the professional design requirements: https://en.wikipedia.org/wiki/Appliance_classes
Most power bricks are class II:
The basic requirement is that no single failure can result in dangerous voltage becoming exposed so that it might cause an electric shock and that this is achieved without relying on an earthed metal casing. This is usually achieved at least in part by having two layers of insulating material surrounding live parts or by using reinforced insulation
However, if you're building a transformer-based device you may find it easier to put it in an earthed metal case and make a Class I device. In that case, wire everything directly avoiding running mains on a PCB shared with non-mains power. That saves you having to worry about creepage distances.
You also need to make sure your cable is mechanically attached properly with a strain relief, or use an IEC plug/socket arrangement like PC power supplies. You cannot allow solder to take any force of users pulling on the cable.
There is also this Apple charger teardown and another article on the same blog about the design errors of fake Apple chargers which cover key issues.
If you're shipping it commercially, you will need to make it CE/UL compliant, and this increases the testing cost. That's why most manufacturers prefer power bricks these days.