Skip to main content

Introduction

This tutorial guides you through creating your first custom app using Frappe Framework v15—a full-stack, low-code platform that powers ERPNext.

Whether you’re a Python developer, ERP consultant, or a tech entrepreneur, this guide offers hands-on experience with Frappe’s modular architecture, DocType creation, scripting, and backend logic.

You’ll create a basic app to manage “Books” and understand how DocTypes, permissions, REST APIs, and front-end forms work in unison.

Core Sections

Overview

In this tutorial, you will:

  • Create a custom Frappe app (library_management)
  • Create a site and install the app
  • Define custom DocTypes like Book and Library Member
  • Add fields, relationships, and permissions
  • Build backend logic and test APIs

By the end, you’ll have a functioning app with both backend and UI, powered by Frappe’s out-of-the-box features.

Installation / Setup

Prerequisites

Ensure you’ve followed the Frappe v15 Installation Guide.

Create and Setup Bench

bench init my-bench --frappe-branch version-15
cd my-bench
bench new-site library.local

Create Your First App

bench new-app library_management

Follow the CLI prompts:

  • App Name: Library Management
  • App Title: Library Management
  • App Description: App for managing library resources
  • App Publisher: Your name/company
  • Email, license, etc.

Install App on Site

bench --site library.local install-app library_management

Start Development Server

bench start

Access: http://localhost:8000
Login with Administrator credentials you set during new-site.

Configuration

Navigate to Library Management > Library Management > DocType in the UI.

Create a New DocType: Book

  • Name: Book
  • Module: Library Management
  • Check “Is Submittable”
  • Add Fields:
    • title → Data
    • author → Data
    • isbn → Data
    • status → Select (Available, Issued)

Save and reload.

Create Another DocType: Library Member

  • first_name → Data
  • last_name → Data
  • email_id → Data
  • membership_expiry_date → Date

Functional Use

Now your app has two main DocTypes:

  • Book: Manages book inventory
  • Library Member: Tracks members

You can:

  • Add records using the web UI
  • Link them together
  • Assign roles and permissions

Frappe auto-generates forms, list views, and REST APIs.

Developer Reference / API

To fetch records via REST:

GET /api/resource/Book

To create a new Book via API:

curl -X POST https://library.local/api/resource/Book \
-H "Authorization: token <api_key>:<api_secret>" \
-H "Content-Type: application/json" \
-d '{
"title": "The Alchemist",
"author": "Paulo Coelho",
"isbn": "978-0061122415",
"status": "Available"
}'

To add custom server logic, use hooks like:

# in library_management/library_management/book/book.py
def before_insert(self):
if not self.title:
frappe.throw("Title is required")

Practical Use Case

Scenario: A small-town library wants to digitize its book borrowing system. Instead of using spreadsheets, they deploy Frappe v15 and:

  1. Create a custom app: Library Management
  2. Define DocTypes: Book, Library Member, Borrow Entry
  3. Add custom workflows for issuing/returning
  4. Use print formats to generate receipts
  5. Set automated email reminders for overdue returns

In just a few days, they build a tailored ERP solution—without licensing fees or coding from scratch.

Advanced Features

  • Child Tables: Create a Borrowed Book child table linked to a Borrow Entry DocType
  • Workflows: Add approval states for new book purchases
  • Role Permissions: Restrict access to librarians only
  • Print Formats: Design borrower receipts in Jinja templates

Tips, Best Practices & Pitfalls

Best Practices:

  1. Use descriptive fieldnames and keep naming consistent.
  2. Leverage client-side scripting only for UI—not validations.
  3. Modularize Python logic and avoid fat Doctype classes.

Common Pitfalls:

  • Skipping bench migrate after adding DocTypes = broken schema.
  • Not creating separate apps = harder upgrades later.
  • Overuse of custom scripts = security risks.

v15 Notes:

  • Vue 3 is fully supported for frontend customization.
  • DocType UI is faster and more responsive than previous versions.

Visual Suggestion

  • Diagram: Frappe MVC Flow (Doctype → DB → API → UI)
  • Screenshot: Custom DocType creation screen
  • Workflow: Book Issuance Approval Flow

Conclusion

Frappe Framework v15 empowers you to quickly build full-featured business applications. With this tutorial, you’ve taken the first step into the Frappe ecosystem—equipped to create modular apps, manage business logic, and connect data across users and interfaces.

Click to rate this post!
[Total: 1 Average: 5]