Skip to content

Instantly share code, notes, and snippets.

@revant
Last active July 24, 2025 06:56
Show Gist options
  • Select an option

  • Save revant/543179ec9b4442674a61c6d760a6d34a to your computer and use it in GitHub Desktop.

Select an option

Save revant/543179ec9b4442674a61c6d760a6d34a to your computer and use it in GitHub Desktop.
ERPNext Development for beginners

Prerequisites:

FAQ

How to setup development bench?

Easiest way to start development bench is using frappe_docker VS Code devcontainer Read more about Development Setup

Why docker? Setting up bench on various distributions natively may be difficult, mac os native bench also requires set of steps unique to Apple device. Windows is not natively supported.

In case if docker is already installed, the steps to start and setup more or less remain same across all above operating systems.

Docker on non linux OS requires VM to run, Allocate sufficient RAM for the vm that runs docker.

In case of windows, using WSL or WSL2 for docker desktop is recommended. HyperV cannot publish ports on host machine. HyperV publishes ports on VM IP.

What is developer mode?

Certain features are blocked from UI for production mode. These features are only available once developer_mode is enabled. DO NOT enable developer_mode on production machines.

Once developer mode is enabled the framework can generate and modify the source files in frappe framework apps. e.g. If Standard Report is added under a module, a directory and set of files are created under that module in the app where module is located. In case user adds Standard Report in frappe or erpnext module, it will create files in frappe or erpnext source tree. This will make the production system non-upgradable unless the unstaged git change are committed or removed.

In case of development environment, the files are committed and pushed on the a repository by developer where further pipeline is triggered.

How to create new frappe app?

Use the bench new-app command, for details use the cli help bench new-app --help. Bench Development Command

How to install custom app for development?

from frappe-bench directory

bench --site site.local install-app custom_app

How to create Standard DocType?

From Awesome Bar: new DocType

Refer https://frappeframework.com/docs/user/en/basics/doctypes

What are the DocType naming conventions?

Refer https://frappeframework.com/docs/user/en/basics/doctypes/naming

How to implement DocType server side validations using python Controller?

Refer https://frappeframework.com/docs/user/en/basics/doctypes/controllers#controller-methods

How to customize DocType UI using Custom Script?

Refer https://frappeframework.com/docs/user/en/desk/scripting/client-script

In case of custom app, do not use Custom Script DocType. Use hooks.py and place the file in public/js directory of custom app :

doctype_js = {
    "Customer" : "public/js/custom_customer.js",
}

How to create Fixtures for Custom Field, Property Setter, and other DocTypes?

Refer https://frappeframework.com/docs/user/en/guides/app-development/how-to-create-custom-fields-during-app-installation

DO NOT export all fixtures, always filter for each app. e.g.

fixtures = [
    {
        "dt": "Custom Field",
        "filters": [
            [
                "name",
                "in",
                [
                    "Delivery Note Item-xcustom_serials",
                    "Customer-xcustom_customer_bin_id",
                ],
            ],
        ]
      },
]

How to create Standard App Features, like Custom Reports?

Query Report: https://frappeframework.com/docs/user/en/guides/reports-and-printing/how-to-make-query-report Script Report: https://frappeframework.com/docs/user/en/guides/reports-and-printing/how-to-make-script-reports

How to add cron scheduler to custom app?

Create a python module and write a function to schedule and mention it in hooks.py:

scheduler_events = {
    "hourly_long": ["custom_app.schedules.purchase.process_purchase_orders"]
}

How to add custom ReST endpoint, RPC function? Security concerns?

Custom App : https://frappeframework.com/docs/user/en/guides/integration/rest_api#rpc Without Custom App: https://frappeframework.com/docs/user/en/desk/scripting/server-script

How to deploy applications in CI/CD pipeline using Gitlab, Docker Swarm and Portainer?

Build latest tagged images on push to main branch. Use Release script to tag versions once users approve latest tag.

Refer :

Place the release script in the root of your app.

Release steps

execute following command from your custom app dir, e.g. frappe-bench/apps/custom_app

./release --help
usage: release.py [-h] [-d] [-j | -n | -p]

optional arguments:
  -h, --help     show this help message and exit
  -d, --dry-run  DO NOT make changes
  -j, --major    Release Major Version
  -n, --minor    Release Minor Version
  -p, --patch    Release Patch Version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment