Generate form fields by field db

I want to dynamically generate a custom form to add a product with specific fields related to the product category. I have a database table where I define the fields with a type (enum) e.g. text, number, select + options, Label (Text), required(bool), category (id of category table).

How is it possible to have the same form but different field per selected and save it as an object in the created product record?