- Read
/src/scripts/README.mdto understand how to setup environment variables and tests connections. - Explore Embeddable Documentation.
- Explore Cube.js Documentation to understand how to work with CUBE.
-
Database tables and relations are defined in
/src/models. -
We have a DMMF to *.cube.yml parser to for automatic cube.yml generation from DMMF. You may find a script in SCALIS project.
-
Every and all queries must join with
companyIdto ensure data isolation between companies. As of 20/02/2025, Embeddable is yet to support features such asfragmentsorqueryRewrite. To achieve data isolation, following steps are required: -
Employ dynamic SQL generation in
company.cube.yml:
SELECT * FROM "Company"
{% if COMPILE_CONTEXT.securityContext.companyId %}
WHERE "Company"."id" = '{ COMPILE_CONTEXT.securityContext.companyId }'
{% else %}
WHERE 1 = 1
{% endif %}-
Ensure that every query execution joins with
Companytable by adding a filter below to every dataset to be used in https://app.us.embeddable.com/en/workspace/${workspaceId}
-
If you're working with
Survey FormsthecompanyIdfilter is handled by thesurvey_form_templatecube to prevent loop issues
-
A
securityContextis being properly sent on the client/consumer similar to Scalis frontend integration
const securityContext = { companyId: session?.user.workspace?.currentCompany.id }pnpm i # requires Node.js 20 or later
pnpm embeddable:build && pnpm embeddable:push -- --email <Email> --message <Message>
Now you can head back to https://app.embeddable.com and "Create new Embeddable" using the components and models from your code bundle.
This is a "Preview workspace" (local to you) that allows you make changes locally and see them instantly without needing to "Build and Deploy".
pnpm dev
It opens a "Preview" workspace, that uses your local components and models.
TIP: If you're using Brave, you might need to disable Brave Shields for this to work.