Timill Platform provides four powerful scripting environments for customization and automation, each designed for different use cases and user skill levels.
Scripting Environments at a Glance#
| Environment | Language | Who Uses It | Runtime | Sandboxed |
|---|---|---|---|---|
| Scripted Charts | JavaScript (Goja ES5.1) | End users — via UI | Browser + Backend | Yes |
| Scripted Widgets | Go Templates (html/template) | End users — via UI | Backend | Yes |
| Backend Scripts | Goja / Gonja | Admins — event-driven automation | Backend VM pool | Yes |
| Custom Widgets SDK | Go + templ | Developers — compiled widgets | Backend (compiled) | N/A |
When to Use Each Environment#
Scripted Charts#
Create dynamic data visualizations using Apache ECharts.
Best For
- Status distribution charts
- User workload bars
- Priority scatter plots
- Any chart that needs real-time data
Example: Create a pie chart showing item status distribution — all via the UI, no coding required.
Scripted Widgets#
Build custom HTML widgets using Go’s html/template syntax with built-in query helpers.
Best For
- Item lists with custom filters
- Status dashboards
- Recent activity feeds
- Widgets that need RBAC enforcement
Example: Create a widget showing open tasks for a specific user — rendered server-side with full access control.
Backend Scripts#
Run server-side automation scripts triggered by events or schedules.
Best For
- Complex business logic
- Cross-group operations
- External API integrations
- Scheduled maintenance tasks
Supported languages:
- JavaScript (via Goja VM)
- Go Templates (via Gonja — Jinja2-compatible)
Custom Widgets SDK#
Build compiled custom widgets using Go and the templ template engine — the same technology used by built-in widgets.
Best For
- High-performance widgets
- Complex data transformations
- Widgets requiring custom Go logic
- Reusable widget libraries
Example: Create a burndown chart with custom calculation logic.
See: Custom Widgets SDK Documentation
JavaScript API Reference#
All JavaScript-based scripts (charts, some backend scripts) share a common API:
| Object | Purpose |
|---|---|
userId | Current user ID |
groupId | Group ID (if group-scoped) |
user | User profile and operations |
group | Group operations and data access |
item | Current item (if item-scoped) |
api | Data transformation helpers |
echarts | Chart configuration helpers |
See: API Reference
Security Model#
All scripting environments are sandboxed with the following security features:
| Feature | Charts | Widgets | Backend Scripts |
|---|---|---|---|
| RBAC Enforcement | ✅ | ✅ | ✅ |
| Script Timeout | 10s | 30s | 60s |
| API Call Limit | Yes | Yes | Yes |
| SSRF Protection | Yes | Yes | Yes |
| No File System Access | ✅ | ✅ | ✅ |
| No Network (except fetch) | ✅ | ✅ | ✅ (rate limited) |
Examples Gallery#
Ready-to-use examples for each scripting type:
- Scripted Widgets Examples — Item lists, dashboards, activity feeds
- Scripted Charts Examples — Pie charts, bar charts, scatter plots
Next Steps#
- For end users: Start with Scripted Charts or Scripted Widgets
- For admins: Learn Backend Scripts for automation
- For developers: Explore the Custom Widgets SDK