Keep your army value around at least at a third of the AIs score. You can go a bit lighter on peaceful civs that are far away, and go heavier on aggressive civs that are close by. But a third of their army value will usually deter the AI. And if they do attack, you should usually be fine if you are around their tech level (warriors) and fortify on key positions.
Getting wonders such as Artemis is not recommended early on if you don't know what you're doing. Play it safe, expand and maintain a deterrent force behind it.