The thing that makes any story interesting and worth reading is conflict. Fortunately, it comes in various forms with the broadest categories being internal conflict and external conflict, growing from setting and characters in addition to the expected problems related to plot.
A tutorial created by Grace Sabella, a writer on DeviantArt, talks about some methods to developing conflict in a story. Something from the tutorial that has really stuck with me since I read it a while ago is the idea of creating the antagonist of a story before the protagonist so that they can complement each other well for the purposes of the story. This can also help to avoid flat villains/antagonists in longer works where many arcs have already been conceptualized and there is the danger that the hero will be much more fleshed out in contrast somewhere down the line. If possible, the hero can be tailored to have the ability to counter each of these conflicts before the writing even begins, and without possibly resorting to a deus ex machina at some point. That is just one of her points.