Developing frappe app on existing db

Hi all,

I have an existing app written in PHP that I want to rebuild on Frappe.

The postgres dB schema is quite complex in terms of tables and relations, so I was wondering if and how I can automate the generation of all the doctypes for each table, to avoid the huge manual work on the GUI to rewrite all the field names, column types, etc.

Thanks in advance,

Hey !
Each doctype is described by a json file, so you can create a script that take the db model of your PHP application to translate it to doctype json.

You should manipulate the GUI and create a Doctype on your side to better understand the json syntax, but you can also refer to some existing examples: erpnext/contract.json at develop · frappe/erpnext · GitHub


Hi Jean Baptiste,

thanks for your suggestion, do you know if there’s any pre-made script of such kind I can start from?

Also, is there anything in Frappe’s roadmap to have a reverse engineering functionality to import existing DB models? It would for sure accelerate the migration of projects to Frappe framework.


Hey !
Sadly, I dont know any such tool … Same for the roadmap

In your position, I would suggest to

  • install a development version of frappe, at some point you’ll need one for testing at some point
  • create your custom app with bench (Create an App)
  • manipulate the doctypes: the generated files are pretty clears, you’ll reverse the logic easily !


It’s unlikely that something like this will ever exist. Frappe and postgres schema concepts do not map 1:1, and as a consequence pretty much any non-trivial translation would need to be use-case specific.

Thank you all.