The point of Stardew Valley is to run a farm, forage the nearby woods and mountains, and in general make money by being completely self-sufficient. So while you can buy fertilizer, flour, and sugar from nearby shops like Pierre's and JojaMart, you can also make them on your farm if you grow the right crops and collect the raw materials you need.