Tutorial Guide & Project Setup
- You're new to the Lovrabet ecosystem
- You want to do custom development but don't know where to start
- You want a step-by-step complete example
- Master the complete development process: from project creation to deployment
- Build a customer management module independently (list, detail, form, report)
- Understand how tools (CLI, SDK, MCP, SQL) work together
Estimated Learning Time: 60-90 minutes (can be done in sections)
What Will We Build?
We'll build a Customer Management System from scratch with these features:
| Feature | Description | What You'll Learn |
|---|---|---|
| Customer List | Display customer data with filtering and pagination | SDK basic queries |
| Customer Detail | View customer details on click | Data association queries |
| Add Customer | Form submission, save to database | Data creation |
| Edit Customer | Modify existing customer info | Data update |
| Sales Report | Customer sales statistics | Custom SQL |
| Data Validation | Validate data before saving | Backend Function |
Final Result: A complete business module ready for production use.
Learning Path
📦 Phase 1: Preparation (10 min)
└── [1. Environment Setup & Project Creation](#1-environment-setup--project-creation)
📦 Phase 2: Basic Features (30 min)
├── [2. List Page: Pagination & Filtering](./scenario-data-list)
├── [3. Detail Page: View & Edit Data](./scenario-data-detail)
└── [4. Form Page: Create & Update Data](./scenario-data-form)
📦 Phase 3: Advanced Features (30 min)
├── [5. Master-Detail Form: Order & Order Items Transaction](./scenario-master-detail)
├── [6. Join Query: Display Customer Info in Orders](./scenario-multi-table)
└── [7. Report Page: Sales Statistics with SQL](./scenario-data-report)
📦 Phase 4: Expert Features (20 min)
├── [8. Data Validation: Backend Interception](./scenario-bf-pre-validation)
├── [9. Data Masking: Phone & ID Card Processing](./scenario-bf-post-validation)
└── [10. Complex Statistics: SQL in Backend Function](./scenario-bf-sql)
📦 Phase 5: Deployment (10 min)
└── [11. Build & Deploy](#11-build--deploy)
1. Environment Setup & Project Creation
1.1 Prerequisites
Before starting, make sure you have:
| Requirement | Details | How to Get |
|---|---|---|
| Node.js | Version >= 18 | Download |
| Code Editor | VS Code recommended | Download |
| Lovrabet Account | Registered | Sign Up |
| App AppCode | App created | Get from workspace after creating an app |
AppCode is your app's unique identifier on the Lovrabet platform. Find it in Lovrabet Workspace → App Settings → Basic Info. Format is like app-c4c89304.
1.2 Install CLI Tool
The CLI (Command Line Interface) helps you quickly create projects, generate code, and deploy.
Open your terminal (PowerShell or Git Bash for Windows users) and run:
# Install CLI
npm install -g @lovrabet/cli
# Verify installation
lovrabet --version
Seeing the version number means installation was successful.
1.3 Login to Your Account
lovrabet auth
This will automatically open your browser for login. After successful login, your terminal will show:
✔ Login successful! Credentials saved locally
Future CLI commands will automatically use this login state.
1.4 Create Project
# Create project
lovrabet create
The CLI will ask you a few questions:
* Project name: customer-management
* App AppCode [optional]: app-c4c89304 ← Enter your AppCode
* Auto-pull API config? ▶ Yes ← Select Yes
✔ Copying project files
✔ Updating project config
✔ Installing npm dependencies
✔ Pulling API config
🎉 Project created successfully!
cd customer-management
lovrabet start
The CLI automatically fetches all your app's dataset info from the platform and generates SDK code. This gives you IDE autocomplete for field names and types.
1.5 Start Development Server
cd customer-management
lovrabet start
Your browser will automatically open http://localhost:5173 showing the initial project page.
1.6 Configure AI Assistance (Highly Recommended)
If you use Cursor or Claude Desktop, configuring MCP lets AI understand your business data for more accurate code generation.
Create .cursor/mcp.json in your project root (for Cursor) or edit Claude Desktop config:
{
"mcpServers": {
"lovrabet-dataset": {
"command": "npx",
"args": ["-y", "@lovrabet/dataset-mcp-server"],
"env": {
"LOVRABET_APP_CODE": "app-c4c89304"
}
}
}
}
- AI automatically gets your table structure
- Generated code has 100% accurate field names
- Complex queries (JOINs, aggregations) done by AI
- 3-5x development efficiency boost
Phase 1 Complete!
You now have:
- ✅ CLI tool installed
- ✅ Project created
- ✅ Development server running
- ✅ AI assistance configured (optional)
Next Step: Start building the Customer List Page - the most fundamental feature and your starting point for learning the development workflow.
11. Build & Deploy
When you've completed all feature development, you can build and deploy to production.
11.1 Build Project
lovrabet build
After building, the dist/ directory will contain two files:
dist/
├── index.js # JavaScript code
└── index.css # Styles
11.2 Upload to CDN
Upload these two files to your CDN or server and get HTTPS URLs:
https://cdn.example.com/customer-management/index.jshttps://cdn.example.com/customer-management/index.css
You can use Alibaba Cloud OSS, Tencent Cloud COS, your own server (with HTTPS), or free hosting services like Vercel or Netlify.
11.3 Set Menu Names (Important)
Before syncing menus, ensure your pages have correct display names. CLI extracts menu names by this priority:
displayName > Component Name > File Path
Recommended: Use displayName
function CustomerList() {
// ...
}
// Set menu display name
CustomerList.displayName = "Customer List";
export default CustomerList;
Arrow Function Style:
const CustomerList = () => {
// ...
};
CustomerList.displayName = "Customer List";
export default CustomerList;
| Method | Example | Menu Name |
|---|---|---|
| displayName (Recommended) | Component.displayName = "Customer List" | Customer List |
| Component Name | function CustomerList() | CustomerList |
| File Path | src/pages/customer/list.tsx | customer/list |
11.4 Sync Menus to Workspace
For first deployment, use the sync command to create menus:
lovrabet menu sync
The CLI will scan your local pages and let you select which menus to sync:
Menu Name Local Remote
Customer List ✓ ✗ (needs creation)
Customer Detail ✓ ✗ (needs creation)
Sales Report ✓ ✗ (needs creation)
* Select menus to sync:
[✓] Customer List
[✓] Customer Detail
[✓] Sales Report
* JS URL: https://cdn.example.com/customer-management/index.js
* CSS URL: https://cdn.example.com/customer-management/index.css
√ Menus created successfully
Now open Lovrabet Workspace and you'll see your developed pages in the menu!
11.5 Iterative Updates
After modifying code and redeploying, use the update command to batch update resource URLs:
# 1. Rebuild
lovrabet build
# 2. Upload to CDN (get new URLs)
# https://cdn.example.com/customer-management/index-v2.js
# https://cdn.example.com/customer-management/index-v2.css
# 3. Batch update all menu resource URLs
lovrabet menu update
sync vs update
| Command | Purpose | Use Case |
|---|---|---|
menu sync | Create new menus | First deployment, adding new pages |
menu update | Update resource URLs | Redeploying after code changes |
- Integrate Custom Pages into Workspace — Understanding Lovrabet's micro-frontend architecture
- Sync Menus to Workspace — Complete sync/update command reference
- SDK Configuration — Production environment configuration
Congratulations!
You've completed the full learning journey from zero to one, mastering:
| Skill | Description |
|---|---|
| CLI Usage | Create projects, build, deploy, menu sync |
| SDK Queries | filter, getOne, create, update |
| Custom SQL | Complex reports, statistical analysis |
| Backend Function | Data validation, business logic |
| AI-Assisted Development | Configure MCP for AI to understand your business |
What's Next?
Deep Dive
- SDK Introduction — Complete SDK overview
- Filter API — Advanced query techniques
- SQL API — Custom SQL details
- Backend Function — Backend business logic extension
- Error Handling — Exception capture and handling
Architecture & Deployment
- Integrate Custom Pages into Workspace — Micro-frontend integration details
- Sync Menus to Workspace — Complete deployment workflow
- CLI Command Reference — All CLI commands
Other Resources
- Development Guidelines & Common Pitfalls — Development standards and performance optimization
- FAQ — Check here first when you have issues
- OpenAPI Documentation — Direct API calls from mini-programs and apps
- MCP Configuration — Advanced AI-assisted development