Json files (datapacks) is the way you do this. You will find a lot of information about them on the internet.
The main community developed documentation I know about are:
https://misode.github.io/ and https://minecraft.fandom.com/wiki/Data_pack
the second of those is really just a collation of all the minecraft release notes.
The first also has the vanilla world gen files:
https://github.com/misode/mcmeta/tree/data/data/minecraft/dimension
https://github.com/misode/mcmeta/tree/data/data/minecraft/dimension_type
https://github.com/misode/mcmeta/tree/data/data/minecraft/worldgen
Those json files are just configuration files that create java objects using codecs: https://forge.gemwire.uk/wiki/Codecs
either as;
* simple values or "records"/collections of them
* references to objects created from other json fles
* references to objects that are constructed and registered programmatically such as the vanilla provided presets, dimensions, chunk generators, carvers, features, structures, etc.
If you want to create flat terrain, I would suggest you start with vanilla's FlatLevelSource and FlatLevelGeneratorPresets and follow the rabbit hole.
As for tutorials, even if you find one, it is likely out-of-date. The modern worldgen has been marked as experimental since 1.16.
Mojang keep iterating on it without any real constraints of compatiblity across versions - the json file formats are more stable than the code they configure
I would suggest you read the vanilla source - net.minecraft.world.level.levelgen.* and net.minecraft.data.worldgen.*
or search on github for up-to-date implementations by other mods of the classes you are interested in.