Building a Small CRM Module with AuraBoot
A step-by-step tutorial showing how to build a small CRM module — leads, accounts, contacts, and pipeline — using AuraBoot's DSL-driven approach.
Building a Small CRM Module with AuraBoot
This tutorial builds a small but useful CRM slice: lead tracking, account management, contact relationships, and a simple sales pipeline. It is not a replacement for a mature CRM, but it shows the shape of an AuraBoot module from model to page.
Prerequisites
Make sure you have AuraBoot running locally:
git clone https://github.com/AuraBootTeam/AuraBoot.git
cd AuraBoot
docker compose --profile full up --build -d
Log in at http://localhost:3000 with the default admin account.
Step 1: Define the Lead Model (5 minutes)
Create a new plugin directory at plugins/my-crm/ and add a models.json:
[
{
"code": "crm_lead",
"name": "Lead",
"tableName": "mt_crm_lead",
"description": "Sales leads from various channels"
}
]
Next, define your fields in fields.json:
[
{
"modelCode": "crm_lead",
"code": "name",
"name": "Lead Name",
"dataType": "TEXT",
"required": true
},
{
"modelCode": "crm_lead",
"code": "email",
"name": "Email",
"dataType": "TEXT"
},
{
"modelCode": "crm_lead",
"code": "company",
"name": "Company",
"dataType": "TEXT"
},
{
"modelCode": "crm_lead",
"code": "status",
"name": "Status",
"dataType": "DICT",
"dictCode": "crm_lead_status"
},
{
"modelCode": "crm_lead",
"code": "source",
"name": "Lead Source",
"dataType": "DICT",
"dictCode": "crm_lead_source"
}
]
Step 2: Add Dictionaries (3 minutes)
Define the dropdown values in dicts.json:
[
{
"code": "crm_lead_status",
"name": "Lead Status",
"items": [
{ "value": "NEW", "label": "New", "sort": 1, "color": "#3B82F6" },
{ "value": "CONTACTED", "label": "Contacted", "sort": 2, "color": "#F59E0B" },
{ "value": "QUALIFIED", "label": "Qualified", "sort": 3, "color": "#10B981" },
{ "value": "CONVERTED", "label": "Converted", "sort": 4, "color": "#8B5CF6" },
{ "value": "LOST", "label": "Lost", "sort": 5, "color": "#EF4444" }
]
},
{
"code": "crm_lead_source",
"name": "Lead Source",
"items": [
{ "value": "WEBSITE", "label": "Website" },
{ "value": "REFERRAL", "label": "Referral" },
{ "value": "LINKEDIN", "label": "LinkedIn" },
{ "value": "COLD_CALL", "label": "Cold Call" }
]
}
]
Step 3: Create Commands (5 minutes)
Commands define what users can do with leads. Add commands.json:
[
{
"modelCode": "crm_lead",
"code": "crm_lead__create",
"name": "Create Lead",
"actionType": "CREATE",
"triggerMode": "FORM"
},
{
"modelCode": "crm_lead",
"code": "crm_lead__update",
"name": "Update Lead",
"actionType": "UPDATE",
"triggerMode": "FORM"
},
{
"modelCode": "crm_lead",
"code": "crm_lead__delete",
"name": "Delete Lead",
"actionType": "DELETE",
"triggerMode": "DIRECT"
},
{
"modelCode": "crm_lead",
"code": "crm_lead__convert",
"name": "Convert to Account",
"actionType": "UPDATE",
"triggerMode": "DIRECT",
"fieldDefaults": {
"status": "CONVERTED"
}
}
]
Step 4: Design the Page (7 minutes)
Create a list-detail page in pages.json:
[
{
"key": "crm-leads",
"title": "Leads",
"modelCode": "crm_lead",
"pageCategory": "FORM",
"schema": {
"type": "list-detail",
"list": {
"columns": ["name", "company", "status", "source", "created_at"],
"filters": ["status", "source"],
"defaultSort": { "field": "created_at", "order": "desc" }
},
"detail": {
"sections": [
{
"title": "Basic Information",
"fields": ["name", "email", "company", "phone"]
},
{
"title": "Classification",
"fields": ["status", "source"]
}
]
}
}
}
]
Step 5: Set Up Permissions and Menus (5 minutes)
Add menu entries in menus.json:
[
{
"code": "crm",
"name": "CRM",
"type": "DIRECTORY",
"icon": "Users",
"sort": 100
},
{
"code": "crm_leads",
"name": "Leads",
"type": "PAGE",
"parentCode": "crm",
"path": "/meta/crm-leads",
"sort": 1
}
]
Step 6: Import and Test (5 minutes)
Import your plugin through the admin UI or CLI:
auraboot plugin import plugins/my-crm/
After import, the platform automatically:
- Creates the database table with all fields
- Registers CRUD permissions
- Publishes the page schema
- Adds the menu to the sidebar
Navigate to CRM > Leads in your sidebar. You now have a working lead management page with filtering, sorting, inline editing, and status tracking.
Going Further: Account and Contact Models
Add crm_account and crm_contact models following the same pattern. Use REFERENCE fields to link contacts to accounts:
{
"modelCode": "crm_contact",
"code": "account_id",
"name": "Account",
"dataType": "REFERENCE",
"refModelCode": "crm_account"
}
AuraBoot automatically renders reference fields as searchable dropdowns and generates the foreign key relationships.
Step 7: Add Quick Actions (Bonus)
One useful feature is context commands — actions that create related records from the current context. Add a "Log Activity" command:
{
"modelCode": "crm_lead",
"code": "crm_lead__log_activity",
"name": "Log Activity",
"actionType": "CREATE",
"targetModel": "crm_activity",
"triggerMode": "FORM",
"fieldMap": {
"entity_type": "lead",
"entity_id": "${recordId}",
"assigned_to": "${CURRENT_USER}"
}
}
When a sales rep clicks "Log Activity" on a lead detail page, a form opens with the lead already linked. After submission, the activity record is created with the relationship pre-filled. No manual linking needed.
You can also add "Convert to Account" as a direct action that changes the lead status and simultaneously creates an account record:
{
"code": "crm_lead__convert",
"actionType": "UPDATE",
"triggerMode": "DIRECT",
"fieldDefaults": { "status": "CONVERTED" },
"sideEffects": [{
"type": "CREATE",
"targetModel": "crm_account",
"fieldMap": {
"name": "${company}",
"primary_contact": "${name}",
"email": "${email}",
"source": "LEAD_CONVERSION"
}
}]
}
What This Tutorial Builds
With only configuration, your CRM now includes:
- Full CRUD with form validation and field-level permissions
- Audit trail for every create, update, and delete operation
- Multi-tenant isolation — each tenant sees only their data
- i18n support — labels automatically resolve through the three-layer i18n system
- API access — every model gets REST endpoints automatically
- AI-ready — AuraBot can query and create leads through natural language
Conclusion
AuraBoot's DSL-driven approach is useful when the first version of an app is mostly models, pages, permissions, and audit behavior. The CRM you just built is intentionally small, but it follows the same structure as larger business modules.
The CRM you built follows the same patterns used in AuraBoot's production CRM plugin, which includes 13 models, AI lead scoring, sales pipeline dashboards, and activity tracking. The architecture scales from this 30-minute tutorial to a full-featured system without changing the underlying approach.
Want to extend it further? Check out our Plugin Development Guide for adding custom workflows, AI scoring, and dashboard analytics.