I have 2 server rather than the localhost ex: staging & development. And I am creating custom fields on the local machine and those fields from different types [entity reference - user reference - image - ...etc] so how to migrate creating these fields on the other servers[staging & development] and even [production server] from inside the code, instead of repeating the same process from the Admin of Drupal-7 every time on different server!?
You might want to have a look to the Features module.
By creating a feature, you can export entities, fields and many other settings created using the admin UI to a module, that then can be installed to your target site.
You may also consider creating a dedicated custom module that holds all your database-stored settings and pre-populated entities/content (e.g. basic taxonomy vocabularies, user roles, permission assignments, ...) set by code instead of the admin UI.
Every setting you can do within the admin UI can be done by code as well, using according hooks, function calls or database queries. And each time you extend your site and settings, you will add an according update hook to keep sites up-to-date that have your module running already. (Staging / Production)
This approach is considerably difficult for beginners to work with, but once you know how to do it, it's worth the efforts. (Speaking from experience.)
Last but not least, you can always synchronize entire databases. For example using the Backup & Migrate module or manual database exports/imports. You just need to make sure to do your settings on a clean version without test data. This approach starts becoming messy once your site is live, but may suit your needs while you still create it.
In Drupal 8, I'd suggest configuration export/import instead, which makes the entire process of configuration management a whole lot easier.