Create custom fields by script

It’s possible create custom fields by script in doctypes of erpnext?

You can use REST api’s via JS. But what’s the use case?

My app need a custom fields in some erpnext doctypes, i don’t wanna create them manually for each install, cause this is a repetitive work

see this link:

https://discuss.frappe.io/t/how-to-push-custom-fields-to-standard-doctypes-in-custom-app/3520/2