D DbFace Docs Product documentation and guides
Extend

Cloud Code

Cloud Code lets you register reusable JSX or JavaScript components on the platform and reference them from DSDL through type: cloud_code. It fills the gap when standard widgets are not enough.

Core concepts

  • Each Cloud Code record uses name as the stable identifier. DSDL refers to it through code_name.
  • A component can have its own default datasource or receive a datasource at execution time.
  • Cloud Code belongs to an organization and is isolated across tenants.

Use in DSDL

---
type: cloud_code
title: Customer Health
code_name: customer_health_panel
---

During rendering, the system resolves the component by code_name. If no matching record exists, the page returns an error-style cloud_code widget.

Management endpoints

Endpoint Description Access
GET /api/v1/cloud-codesList components in the current organizationAuthenticated users
GET /api/v1/cloud-codes/:idRead component detailAuthenticated users
POST /api/v1/cloud-codesCreate a componentadmin / editor
PUT /api/v1/cloud-codes/:idUpdate a componentadmin / editor
DELETE /api/v1/cloud-codes/:idDelete a componentadmin / editor

Execution endpoints

Cloud Code components can trigger backend SQL through dedicated execution APIs:

  • POST /api/v1/cloud-code-execute/:id/query for read-only queries
  • POST /api/v1/cloud-code-execute/:id/mutate for write operations
{
  "sql": "SELECT * FROM orders WHERE id = :id",
  "params": { "id": 1001 },
  "datasource_id": "optional"
}

Execution limits

  • The query endpoint only allows read-only SQL and blocks DML and DDL.
  • The mutate endpoint allows DML but still blocks DDL such as DROP, ALTER, and CREATE.
  • Execution validates that both the Cloud Code component and datasource belong to the current organization.
Cloud Code is best treated as a controlled extension surface, not as an unrestricted backend scripting channel.

Good use cases

  • Business status panels, approval prompts, and compound information blocks.
  • Interactions more complex than standard chart widgets support.
  • Custom frontend rendering on top of controlled query and mutate APIs.

Operational notes

  • If a Cloud Code record is deleted, reports that reference the same code_name will fail.
  • Use stable names and avoid renaming name frequently.
  • If a component depends on a dedicated datasource, bind it at the component layer instead of passing it every time.