Git setup for professional frappe erpnext and custom app development

Hi, I want to start development for erpnext, but I’m missing some kind of a “best practice” for a development setup.
Although I’ve read all of the tutorials, guides, videos available for dev-setups for frappe/erpnext, I did not find answers to the following general and specific questions:

We want to use frappe/erpnext within our startup to handle typical standard processes, therefore I assume we need a bit of customizing. Unfortunately, I have no experience with ERPNext so I can’t tell yet, to which extent. We also need to integrate our own specific business logic, frontends and processes etc. for which I assume is the custom app architecture best.

General question:
I think I understood the concept of apps and how to use them to extend ERPNext. Yet, within various blog posts and READMEs it is implied that several people usually start developing on the ERPNext app files within the bench/apps/erpnext folder itself. Is there any advice on what files can be changed without risk to guarantee upgrade-ability? In future, when I have the apps/erpnext folder in a private git repo, how to install it on a staging and production system then? I assume the bench-commands won’t work then.

Furthermore, the next question is based on using the frappe_docker bootstrap containers as explained here: frappe_docker/ at main · frappe/frappe_docker · GitHub

For a proper dev-setup (and later stating and production) I require to setup a private git repo where I will push everything that has been customized and customly developed. Assuming that all files within the bench directory (apps / sites / … ) are subject to development, I simply do not understand how properly use git to push the changes of my custom app, push the changes of erpnext etc.: After installing frappe, creating a bench etc. all the directories are already polluted with .git folders of various repositories (at least GitHub - frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext).
Even more complicated is the fact, that the bootstrap containers and VS Code Remote Container configuration from the tutorial opens at the top directory of the frappe framework - so the default git plugin of VS Code is totally useless.

If it’s probably too cumbersome to answer my question above, does anyone have a hint / tutorial / guide for a setup with the following characteristics:

  • VS Code
  • Containerized dev scenario with visual studio code where code changes are applied immediately in a bench with DEVELOPER_MODE = true
  • Private GIT Repo with ERPNext changes and a custom app
  • Deployment Pipelines to a staging and production environment

Thank you very much for your help in advance!

Every modification carries some risk. The more you modify = the more time you should spend validating and verifying your modifications. In this respect, ERPNext is no different than any other application.

It does not matter whether you modify the code:

  • directly (i.e. forking and editing preexisting code files)
  • indirectly (Customize, Client/Server Scripts,, guerilla patching, etc).

Either way, some code is added/modified/deleted/skipped. To be safe, those changes should be reconciled with the new version’s code. Do they still work with the new version, or are errors now thrown? Even if there aren’t errors, are the modifications still doing whatever they were supposed to?

As always, Unit Tests and Integration Tests are a fantastic idea.

Here’s a post I made, somewhat related to this topic.

To my knowledge, the Bench commands work fine with private repositories. You just have to authenticate (e.g. Personal Access Token, SSH keys, etc)

I don’t use Frappe Docker, so cannot offer any advice there. Setting that aside, for a regular deployment, there is exactly one git repository per App:

  • The ‘frappe’ App (../apps/frappe/...)
  • The ‘erpnext’ App (.../apps/frappe/...)
  • Apps you download or create yourself (.../apps/foo/...)

When making file modifications, you can perform git ‘add’ and ‘commit’ commands. Just like you would for any other application using git.

Note however, some changes will not be written to files on disk. Certain changes made with the “Customize” button, and Client/Server scripts, are actually saved inside the MySQL database, inside columns. For those changes, git won’t see anything, because the code files haven’t changed.

Check out this post for more information about what 'bench update' does.

For VSCode, I create a single workspace file under ‘apps’. Then I configure the workspace to ignore certain files and directories (e.g. .git, node-modules, __pycache__, python virtual environment, etc.)

1 Like