This is just a really small thing but curious.
In a fantasy world, there's the consideration of firearms. Absolutely the answer is yes; black powder is ridiculously simple to make for a kingdom with any sort of farming/ranching industry.
In the SE-E6 world, most potassium nitrate is probably mined, but it's possible to manufacture it as well. Potassium nitrate is probably the most difficult component to obtain for gunpowder but it's not hard to manufacture if you have a large supply of animal manure and some human workers to work the process. It is disgusting as fuck though.
Needed resource two is charcoal. I am fairly certain one could use mined coal, but since burned wood is just a thing in any fantasy setting (heat is just a thing that's needed), charcoal is plentiful as hell.
Sulfur must be mined in a fantasy setting. It's plentiful in the real world, and not much is needed to create black powder.
What's important though is the value and availability of black powder versus other things that do the same thing. As the propellant and/or warhead in projectile weaponry, black powder is pretty good since a little bit goes a fairly long way. It doesn't take much material to propel a musket ball and even less to fire a revolver or rifle cartridge. It takes a bit more to explosively deliver shrapnel to the enemy, so in a fantasy world an alchemical substance might be preferable depending on availability.
More advanced stuff is... a bit tricky! Modern explosives (and actually modern fertilizer too) mostly hinge on nitric acid. Nitric acid is formed in very small amounts naturally by ionizing components naturally in air. The only natural way this happens is from lightning bolts. The amount produced in this way is extremely negligible and in no way would be viable as a resource.
Magic lightning is a thing in the SE-E6 world, but it's pretty rare. Dragons/halfdragons with lightning breath weapons are probably more common than mages with lightning bolt spells by huge orders of magnitude. The problem is that you really need to control the electrical discharge, but it needs to be a very powerful discharge (like that of a lightning bolt or lightning breath weapon). It's possible that this could someday happen but the science involved is very... advanced. Worlds with 5th level spells can just fabricate nitric acid from the air which is totally fucked up. Minor creation can conjure the rest of the components to fabricate nitrocellulose or nitroglycerin. If your game allows you to get to 9th level as a wizard, you can manufacture explosives from the air. Yeah fuck D&D.
So without artificial electricity we're kinda hosed on nitric acid. Or are we?
Alchemy is a funny thing because we don't know what it can do. It can clearly make some kind of explosive stuff because alchemist's fire is a thing. Tanglefoot bags harden when exposed to air. How do you make something like that in a fantasy world? Shit's crazy. Nitric acid might not be so crazy when you consider that.
As for firearm primers (for ammunition), there's a few compounds that can do the job. Most of them are reasonably difficult to make. Sodium chlorate is probably the most plausible since electrolysis is possible through the use of cantrips and/or magic items.