Golden Path β Vue structure β
Only the widget folder contract is raclette-specific. How you structure Vue code beyond that is your choice; this page describes what we recommend when multiple widgets or larger features share code.
*Widget.vue is the entry β
<Name>Widget.vue is the mount point the orchestrator loads. It should:
- call
usePluginApi()insetup(), - declare props (including route-driven
slotParams), - compose child components and composables.
It should not accumulate all business logic when the feature grows.
Reuse across widgets β
| Folder | Purpose |
|---|---|
frontend/components/ | Presentational pieces shared by 2+ widgets |
frontend/composables/ | Stateful logic, $data calls, formatters |
frontend/types/ | Shared TypeScript types (optional) |
frontend/
βββ index.ts
βββ widgets/
β βββ TodoList/
β β βββ TodoListWidget.vue
β β βββ setup.ts
β βββ TodoChart/
β βββ TodoChartWidget.vue
β βββ setup.ts
βββ components/
β βββ TodoRow.vue # used by both widgets
βββ composables/
βββ useTodoItems.tsImport freely between widgets, components, and composables β standard Vue 3 module boundaries.
Vue best practices (brief) β
- Composition API in widgets (
<script setup>is fine). - Keep side effects in composables with
onUnmountedcleanup;usePluginApicleans up$socketlisteners on unmount. - Workbench-tuned values belong in
setup.tsconfigeditors, not hard-coded in the widget. - Pagination / filters β persist via URL
slotParams, not only local state (Writing URL state).
Minimal layout β
One self-contained *Widget.vue is acceptable for trivial UI. Move to the structure above when you add a second widget or shared behavior.
Cookbook β
End-to-end files: Cookbook Β· Setting up a Todo plugin.