/frappe-apps-manager:frappe-microservice-patternfrom frappe-apps-manager
Explains frappe-microservice-lib architecture patterns including bounded context, multi-tenancy, and service isolation for Frappe microservices.
Ships in frappe-apps-manager. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Explain frappe-microservice-lib architecture patterns and best practices.
Central Site: Single source of truth for authentication and user management. All microservices validate sessions against Central Site.
Microservice: Independent service with its own database (bounded context). Handles specific business domain (e.g., Orders, Signups).
Bounded Context: Each microservice owns its data. No shared database between services.
1. Independent Database Each microservice has its own database:
services:
orders-service:
environment:
- DB_HOST=orders-db # Independent database
signup-service:
environment:
- DB_HOST=signup-db # Different database
2. Central Site Authentication All services validate sessions via Central Site:
# Microservice validates session cookie
# Central Site returns user profile with tenant_id
3. Tenant Isolation
Every document has tenant_id:
# Automatic tenant filtering
app.set_tenant_id(tenant_id)
docs = app.tenant_db.get_all('DocType') # Only returns tenant's data
4. No Direct Database Access Never access another service's database directly. Use APIs.
microservice/
├── server.py # Main service file
├── controllers/ # DocType controllers (optional)
│ └── sales_order.py
├── Containerfile # Container definition
├── entrypoint.py # Service entrypoint
└── requirements.txt # Dependencies
def get_current_tenant_id():
from flask import g
from frappe_microservice import get_user_tenant_id
# Check cache
if hasattr(g, 'tenant_id') and g.tenant_id:
return g.tenant_id
# Resolve from user
if hasattr(g, 'current_user') and g.current_user:
tenant_id = get_user_tenant_id(g.current_user)
if tenant_id:
g.tenant_id = tenant_id # Cache for request
return tenant_id
return None
TenantAwareDB: Wrapper that automatically adds tenant_id to all queries:
# ✅ Good - automatic tenant filtering
app.set_tenant_id(tenant_id)
docs = app.tenant_db.get_all('Sales Order')
# Automatically adds: WHERE tenant_id = 'xxx'
# ❌ Bad - no tenant isolation
docs = frappe.db.get_all('Sales Order')
# Returns ALL tenants' data!
Option 1: HTTP APIs
# Service A calls Service B via HTTP
response = requests.get('http://service-b:8000/api/endpoint')
Option 2: Message Queue (for async)
# Publish event
publish_event('order.created', order_data)
Option 3: Shared Events (via Central Site)
# Central Site acts as event bus
Automatic CRUD endpoints:
app.register_resource("Sales Order")
# Creates:
# GET /api/resource/sales-order
# POST /api/resource/sales-order
# GET /api/resource/sales-order/{name}
# PUT /api/resource/sales-order/{name}
# DELETE /api/resource/sales-order/{name}
All endpoints automatically:
Traditional Frappe-style controllers:
# controllers/sales_order.py
class SalesOrder(DocumentController):
def validate(self):
# Validation logic
def before_insert(self):
# Set defaults
Register controllers:
from frappe_microservice.controller import setup_controllers
setup_controllers(app, "./controllers")
Function-based lifecycle hooks:
@app.tenant_db.on('Sales Order', 'before_insert')
def set_defaults(doc):
if not doc.status:
doc.status = 'Draft'
Gradual migration from monolith:
@app.secure_routeapp.tenant_dbPattern 1: Minimal Service
app = create_microservice("my-service")
app.register_resource("DocType") # That's it!
Pattern 2: Service with Controllers
app = create_microservice("my-service")
setup_controllers(app, "./controllers")
Pattern 3: Service with Hooks
app = create_microservice("my-service")
@app.tenant_db.on('DocType', 'before_insert')
def hook(doc):
pass
Pattern 4: Service with Custom Endpoints
app = create_microservice("my-service")
@app.secure_route('/custom', methods=['POST'])
def handler(user):
pass
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
90 skills in this plugin
/frappe-add-service-composeAdd a new microservice to dev-podman-compose.yml with proper configuration, dependencies, and networking./frappe-agent-debuggerUse when debugging Frappe errors, using bench console for live inspection, analyzing tracebacks, or reading Frappe log files. Prevents wasted debugging time from ignoring log context, misreading tracebacks, and not using bench console effectively. Covers bench console, frappe.logger, error log DocType, traceback analysis, common error patterns, log file locations, pdb/debugger integration, VS Code DAP, profiling, Frappe Recorder, mariadb diagnostics. Keywords: debug, bench console, traceback, error log, frappe.logger, pdb, debugging, log analysis, inspect, VS Code, DAP, profiling, recorder, mariadb, monitor, ERPNext error, how to debug, find the bug, what went wrong, stack trace, error message..
/frappe-agent-interpreterUse when receiving vague or unclear ERPNext/Frappe development requests that need interpretation. Transforms requirements like 'make invoice auto-calculate' or 'add approval workflow' into concrete technical specifications. Determines which Frappe mechanisms to use and maps to the full 61-skill catalog. Keywords: vague requirement, clarify scope, translate business need, technical spec, implementation plan, what does this mean, unclear requirement, translate to code, how to build this.
npx claudepluginhub vyogotech/frappe-apps-manager --plugin frappe-apps-managerOther plugins' skills for the same job