Sorry for my bad english grammar. I write a module, allows the user to upload a file that contain list of content types infomation. Then my module will auto create content type for user. But i don't know how to create content type without hard define many .yml file.
If your content type is fairly straight forward (i.e. using only Drupal's fields), you can create the content type within the
http://localhost/admin/structure/types/add link and once you have it built the way you want it you can export it via:
It will even give you the name of yaml file to boot!
If that avenue is not sufficient then you can follow: This tutorial about building custom drupal content entities; it is lengthy in nature, which is why I will elide the details.
And if you're going to use that tutorial, then I would suggest using drupal console to generate the boilerplate code for you. It makes things quite simple. Drupal Console, among other things, manages the generation of content entity boilerplate code. It is quite helpful.