Preheat your oven to 350°F (175°C).
In a large skillet, sauté the diced onion until soft and translucent.
In a mixing bowl, combine ketchup, molasses, Dijon mustard, brown sugar, smoked paprika, garlic powder, cayenne pepper, apple cider vinegar, and water. Mix well.
In a baking dish, layer the cooked navy beans. Pour the sauce mixture over the beans, stirring gently to combine.
Top with bacon slices, if using.
Cover the dish with aluminum foil and place it in the oven to bake for one hour.
Remove the foil and bake for an additional 20-30 minutes until the sauce thickens.
Let cool slightly before serving.