From Development to Production in ERPNext
- Atul
- Technology , Web , Free software , The big o community , Frappe
- June 10, 2025
Table of Contents
From Development to Production in ERPNext
🏰 The Royal Guide to Frappe/ERPNext Customization
A tale of kingdoms, customizations, and magical code implementations ✨
🎯 The Golden Rule of the Realm
Never tamper with the ancient scrolls (standard doctypes) directly! 📜
Instead, we shall create our own magical kingdom and customize from there.
🏗️ Step 1: Establishing Your Kingdom
🌟 Create Your Custom Realm
bench new-app your_magical_kingdom
This creates your very own kingdom where all your customizations will live! 🏰
⚔️ Step 2: The Art of Customization (Not Direct Editing!)
🧙♀️ For Standard Doctypes (The Ancient Scrolls)
When you want to modify existing doctypes like Customer, Item, etc.:
- Navigate to the doctype you want to customize 📋
- Click “Customize” (don’t edit directly!) ✏️
- Make your magical changes ✨
- Export your enchantments:
- Find the “Action” button 🎬
- Click “Export Customization” 📤
- Select your custom kingdom as the module 🏰
- Your customizations are now safely stored in:
bench/apps/your_magical_kingdom/your_magical_kingdom/custom_module/custom/
🏰 For Child Tables Too!
Follow the same ritual for customizing child tables - always export to your kingdom! 👶
🎨 Step 3: Creating Your Own Magical Doctypes
🌟 New Doctype Creation
When creating brand new doctypes:
- Create New Doctype 📝
- IMPORTANT: When asked for module, select YOUR kingdom’s module 🏰
- Never select standard app modules! ⚠️
This creates your doctype’s dwelling in:
bench/apps/your_magical_kingdom/your_magical_kingdom/doctype/your_doctype/
💻 Step 4: The Code Chambers
🐍 Server-Side Spells (Python)
For your custom doctypes:
- Edit the
.py
files in your doctype’s directory directly 📁
For standard doctypes:
- Create a special code chamber:
apps/your_kingdom/your_kingdom/custom_scripts/
- Use
hooks.py
to connect your spells to the standard doctypes 🔗
⚡ Client-Side Magic (JavaScript)
Store all your frontend enchantments in:
apps/your_magical_kingdom/your_magical_kingdom/public/js/
Use hooks.py to bind these spells to your doctypes! 🎯
🚀 Step 5: Deploying Your Kingdom
🌍 Moving from Dev Castle to Production Fortress
Initialize Git in your kingdom:
cd apps/your_magical_kingdom git init git add . git commit -m "Initial kingdom setup"
Push to GitHub:
git remote add origin your-repo-url git push -u origin main
Deploy to Production:
# On production server bench get-app your-repo-url bench install-app your_magical_kingdom
🚨 The Great Database Warning!
⚠️ NEVER Do This Forbidden Ritual!
DO NOT restore dev database backup to production! 💀
Why this spells doom:
.sql
files only contain data records 📊- They DO NOT contain your UI customizations 🎨
- Restoring will overwrite production data 💥
✅ The Proper Way:
- Your customizations live in your custom app code 🏰
- Deploy via Git (code changes) 📝
- Let production keep its own data 💾
🎉 Kingdom Summary
🏰 Action | 🎯 Method | 📍 Location |
---|---|---|
Customize Standard | Use Customize → Export | Custom App |
Create New Doctype | Select Custom Module | Custom App |
Server Code | hooks.py + custom scripts | Custom App |
Client Code | public/js/ | Custom App |
Deploy | Git push/pull | GitHub → Production |
🧙♂️ Final Wisdom
Remember, brave developer:
- One Kingdom for all your customizations 🏰
- Export everything to your realm 📤
- Git is your teleportation spell 🪄
- Never mix dev and prod databases ⚔️
May your code be bug-free and your customizations eternal! ✨🎊