Architecture
Overview
This repository uses pnpm workspaces and Turborepo to coordinate multiple packages:
packages/core: published SDK package (@grist-widget-sdk/core)apps/widgets: local examples/playground appapps/docs: VitePress docs sitetemplates/grist-widget-template-vite: starter project template
Package boundaries
packages/core
- Library package built with
tsup(not a Vite app) - Primary entrypoint:
@grist-widget-sdk/core - Testing subpath:
@grist-widget-sdk/core/testing - Public exports are re-exported from
packages/core/src/hooks/index.ts
apps/widgets
- React + Vite app used to try and showcase SDK usage
- Depends on
@grist-widget-sdk/corethroughworkspace:^ - Uses app-level UI/tooling (Tailwind, shadcn, router) that should not be moved into
packages/core
apps/docs
- VitePress documentation workspace
- Hosts AI-agent-facing operational docs under
apps/docs/files/
templates/grist-widget-template-vite
- Standalone Vite starter
- Also depends on
@grist-widget-sdk/corewithworkspace:^while inside this monorepo - Should stay isolated enough to be used as a scaffolded external project
Runtime model
Widget runtime flow:
text
Grist host document
-> iframe widget app
-> grist-plugin-api global
-> @grist-widget-sdk/core hooks/providers
-> widget React componentsBuild orchestration
turbo.json defines:
builddepends on upstream workspace builds viadependsOn: ["^build"]devtasks are persistent and uncachedtestdepends on upstreambuild
In practice, building apps that consume packages/core first builds the SDK package.