Indonesia is as safe as the US.
Threats from People. Like the US, Indonesia will have dangerous neighborhoods, dangerous people including terrorists, and dangerous experiences like some raucous political demonstrations. But like the US, you can avoid these rather easily and have a great time. Get advice from locals about the neighborhood. Dress so as not to draw attention from locals. Travel in groups. Secure laptops in the hotel safe. Keep phones out of sight unless in use. Spread your cash in multiple pockets. Keep small amounts of cash (called ‘small money’ in Indonesia) in one pocket so you do not show large amounts of cash in public places.
‘Preman’ are petty criminals who extort cash from locals. But since they don’t speak English foreigners are more or less left alone. AVOID police interactions. Don’t do anything that’s likely to draw the attention of police. Don’t drive. Don’t bring expensive items like jewelry with you. If you have to obtain a police report for insurance purposes, bring an Indonesian friend with you to help talk to police. Consider having the friend make the report for you.
Threats from Nature. Like the US, Indonesia has nature-related dangers including earthquakes, tsunamis, volcanoes, and cyclones. And like the US there are precautions you can take like making an emergency plan, but bad weather can happen anywhere including the US or Indonesia.