Frappe is more than just the framework behind ERPNext. It’s a full-stack web framework that lets you build database-driven applications incredibly fast. This guide walks you through building a simple Task Manager app from scratch.

Pre-requisites

Frappe Bench installed (see our Frappe setup guide)
A working Frappe site
Basic Python and JavaScript knowledge

STEP 1 Create the App

cd frappe-bench
bench new-app task_manager

Answer the prompts (app name, description, etc). Then install it on your site:

bench --site mysite.local install-app task_manager

STEP 2 Create a Doctype

Go to http://mysite.local:8000 and search for “Doctype” > New Doctype.

Name: Task Item
Module: Task Manager
Fields:
  - title (Data, Required)
  - description (Text Editor)
  - status (Select: Open, In Progress, Completed, Cancelled)
  - priority (Select: Low, Medium, High, Urgent)
  - assigned_to (Link: User)
  - due_date (Date)

Naming: autoincrement
Sort Field: modified
Sort Order: DESC

STEP 3 Add Server Logic

nano apps/task_manager/task_manager/task_manager/doctype/task_item/task_item.py
import frappe
from frappe.model.document import Document

class TaskItem(Document):
    def validate(self):
        if self.due_date and self.due_date < frappe.utils.today():
            frappe.msgprint("Warning: Due date is in the past")

    def on_update(self):
        if self.status == "Completed":
            frappe.publish_realtime(
                "task_completed",
                {"task": self.name, "title": self.title}
            )

STEP 4 Add Client Logic

nano apps/task_manager/task_manager/task_manager/doctype/task_item/task_item.js
frappe.ui.form.on("Task Item", {
    refresh(frm) {
        if (frm.doc.status !== "Completed") {
            frm.add_custom_button("Mark Complete", () => {
                frm.set_value("status", "Completed");
                frm.save();
            }, "Actions");
        }

        // Color-code priority
        if (frm.doc.priority === "Urgent") {
            frm.dashboard.set_headline(
                'URGENT TASK'
            );
        }
    }
});

STEP 5 Create an API Endpoint

nano apps/task_manager/task_manager/api.py
import frappe

@frappe.whitelist()
def get_my_tasks(status=None):
    filters = {"assigned_to": frappe.session.user}
    if status:
        filters["status"] = status

    tasks = frappe.get_all("Task Item",
        filters=filters,
        fields=["name", "title", "status", "priority", "due_date"],
        order_by="due_date asc"
    )
    return tasks

Call it from anywhere:

curl http://mysite.local:8000/api/method/task_manager.api.get_my_tasks 
  -H "Authorization: token api_key:api_secret"

STEP 6 Build and Run

bench --site mysite.local migrate
bench --site mysite.local clear-cache
bench build
bench start

You now have a working web application with a database, REST API, real-time updates, user permissions, and a complete UI — all built in about 30 minutes. That's the power of the Frappe framework.

Share this article

Comments

Join the discussion. Got a question, found an issue, or want to share your experience?

Leave a Comment

Your email stays private. We just use it for replies.

Nothing to preview yet.

Use **bold**, *italic*, `code`, ```code blocks```, [link](url), > quote, - list