You show a 45 amp controller, with a 40 amp fuse. Size your wire based on length and 45 amps to give you under 2% voltage drop. Then fuse close to the battery with 50 amp or more fuse, depending on what size wire you use. Do the same calculation for the inverter wires. Again fuse close to the battery. These are catastrophic failure fuses and are in addition to the fuses for the individual circuits.