Cookbook Overview
The Frappe Developer Cookbook is the companion to the Guide: 56 self-contained recipes, each roughly 80% code and 20% explanation. Every recipe follows the same shape so you can scan it fast:
- Problem — what you’re trying to solve.
- Solution — complete, runnable code with file paths.
- Why this works — the mechanism in a sentence or two.
- Common mistake — the pitfall to avoid.
Every recipe uses the ScoopJoy franchise theme, and they’re self-contained — jump straight to whichever one matches your current need.
1 · DocType Design & ORM Patterns
Section titled “1 · DocType Design & ORM Patterns”| Recipe | What you get |
|---|---|
| Self-Referencing Tree DocType | Unlimited category nesting with the Nested Set model |
| Multi-Level Child Tables | Simulating nested rows inside a document |
| Virtual DocType | Back a DocType with an external API instead of a table |
| Dynamic Link (Polymorphic) | One field that references many DocTypes |
| Advanced Naming | Format-string, controller, bulk, and cascade naming |
| ORM Power Patterns | Eight high-leverage frappe.db / ORM techniques |
| Fixtures & Data Migration | Shipping seed data with your app |
| Computed & Virtual Fields | Fields derived on read instead of stored |
2 · Controller & Server-Side Patterns
Section titled “2 · Controller & Server-Side Patterns”| Recipe | What you get |
|---|---|
| Validation Chain | Composing readable, ordered validations |
| Document Lifecycle | Orchestrating submit/cancel side effects |
| Background Jobs | Enqueuing and tracking long work |
| Scheduled Tasks | Five kinds of recurring jobs |
| Whitelisted API Methods | A clean mobile-app API layer |
| extend_doctype_class (v16) | The v16 way to extend stock DocTypes |
| Database Transactions | Commit/rollback patterns done right |
| Email & Communication | Sending and threading messages |
3 · Client-Side Recipes
Section titled “3 · Client-Side Recipes”| Recipe | What you get |
|---|---|
| Multi-Step Wizard Dialog | A guided multi-page form dialog |
| Real-Time Dashboard | Live sales numbers over Socket.IO |
| Dynamic Form Manipulation | 15+ form scripting patterns |
| Child Table Operations | Programmatic grid manipulation |
| Custom List View | List views with bulk actions |
| Custom Desk Page | A franchise command-center page |
| Form Script Communication | Talking between scripts and server |
| Frappe UI Components | Reusable Desk UI building blocks |
4 · API & Integration Patterns
Section titled “4 · API & Integration Patterns”| Recipe | What you get |
|---|---|
| Mobile REST API Layer | A versioned API surface for apps |
| Webhook Sender + Retry | Reliable outbound webhooks |
| Incoming Webhook Idempotency | Safe, replay-proof handlers |
| Custom UPI Gateway | A bespoke payment-gateway integration |
| Circuit-Breaker Client | Resilient external API calls |
| File Upload Pipeline | Upload, validate, and process files |
| OAuth2 Connected App | Connecting to Google and friends |
| Node.js/Express Middleware | Bridging an Express app to Frappe |
5 · Queries, Reports & Performance
Section titled “5 · Queries, Reports & Performance”| Recipe | What you get |
|---|---|
| Query Builder Masterclass | Ten frappe.qb patterns |
| Script Report Scorecard | A franchise performance report |
| Query Reports (SQL) | Production SQL-backed reports |
| Redis Caching Strategies | Six caching patterns |
| N+1 Query Elimination | Finding and killing N+1s |
| Database Indexing | An indexing strategy that holds up |
| Materialized View Pattern | Precomputed rollups in Frappe |
| Bulk Data Operations | Fast inserts and updates at scale |
6 · Workflows, Automation & DevOps
Section titled “6 · Workflows, Automation & DevOps”| Recipe | What you get |
|---|---|
| Approval Workflow + Escalation | Multi-level approvals that escalate |
| Document State Machine | Modeling explicit state transitions |
| Notification Engine | Six delivery channels in one engine |
| Scheduled Job Orchestration | Pipelines of dependent jobs |
| Auto Repeat & Recurring | Recurring documents on a schedule |
| Assignment Rules | Four auto-assignment strategies |
| Complete CI/CD Pipeline | Build, test, and deploy a Frappe app |
| Health Check & Monitoring | A monitoring endpoint that means something |
7 · Testing, Security & Production
Section titled “7 · Testing, Security & Production”| Recipe | What you get |
|---|---|
| Unit Testing | Testing controllers in isolation |
| Integration Testing | End-to-end document flows |
| API Endpoint Testing | Exercising whitelisted methods |
| Permission Testing Matrix | Proving roles see what they should |
| Security Hardening | Nine concrete hardening recipes |
| Load Testing with Locust | Finding the breaking point |
| Backup & Recovery Scripts | Backups you can actually restore |
| Docker Production Build | A lean production image pipeline |