Skip to content
github-actions[bot] edited this page Nov 21, 2026 · 2 revisions

Blocks

The pages every app repeats: a privacy policy, a legal notice, "Your data" (download and delete), and a say in counting visits (ADR 0011). The core is @kodentuzo/spotstrap/blocks: the wording, the documents and the logic, for any framework. Views for your framework render them with its shadcn port.

They're built for apps on Spotcraft, from what it gives every app: the legal facts (LEGAL_FACTS, or /_spotcraft/legal.json) and, through spotkit, the user pool and analytics.

pnpm add @kodentuzo/spotstrap @kodentuzo/spotkit

Vue views

With shadcn-vue set up in the app (components.json), add a view from Spotstrap's registry, served at kodentuzo.com and shipped in the npm package (@kodentuzo/spotstrap/registry/vue/). It's copied into your components folder, with the shadcn-vue components it needs and the npm packages:

pnpm dlx shadcn-vue@latest add https://kodentuzo.com/spotstrap/r/vue/privacy-policy.json
Item View Shows
privacy-policy PrivacyPolicy.vue the privacy policy, from facts, app-name and app-data
legal-notice LegalNotice.vue who runs the app, from facts
your-data YourData.vue download and delete, with a confirmation; a slot for more
analytics-switch AnalyticsSwitch.vue "Count my visits", wherever visits are counted
analytics-prompt AnalyticsPrompt.vue in opt-in mode, asks once whether to count visits
legal-links LegalLinks.vue footer links to the three pages
sync-status SyncStatus.vue where changes are: on this device, on their way, or saved
stored-here StoredHere.vue a short “saved on this device first” explainer
legal-document LegalDocument.vue renders any document; the policy and notice use it
<YourData app-name="Sokobanko" :export-app="exportProgress">
  <AnalyticsSwitch />
</YourData>
<PrivacyPolicy :facts="facts" app-name="Sokobanko" :app-data="appData" />
<AnalyticsPrompt />

The views are yours once copied: change them as you like. The wording and logic stay in @kodentuzo/spotstrap/blocks, so updating the package updates them. AnalyticsSwitch and AnalyticsPrompt render nothing off Spotcraft, or when /_spotcraft/config.json can't be read.

Privacy policy and legal notice

import { legalNotice, privacyPolicy } from '@kodentuzo/spotstrap/blocks'
import { legalFacts } from '@kodentuzo/spotkit' // on the server; `legal()` from /client in the browser

const policy = privacyPolicy(legalFacts(), {
  appName: 'Sokobanko',
  // What your app stores beyond the platform's processing, in your words.
  appData: [
    {
      what: 'Your solved levels and their moves',
      why: 'to show your progress and best results',
      kept: 'until you delete your data',
    },
  ],
})
const notice = legalNotice(legalFacts())

Both return a document: { title, intro?, sections: [{ id, heading, blocks }], footer? }. A block is { type: 'paragraph', content } or { type: 'list', items }, and content is plain strings and links ({ text, href }). There's no HTML in it: render each part with your own elements. toText(doc) gives it as plain text.

The policy has a section for who is responsible, one per processing the instance does (with its reason, legal basis, time limit, processor and any transfer outside the EU), what your app stores, cookies and storage, the user's rights, and where to complain. When the owner hasn't filled in their details on Spotcraft yet, the sections say so instead of staying empty.

Dates are in UTC with a fixed locale, so a page renders the same on the server and in the browser.

Your data

import { createYourData } from '@kodentuzo/spotstrap/blocks'
import { deleteMe, exportMe } from '@kodentuzo/spotkit/client'

const yourData = createYourData(
  { exportMe, deleteMe },
  {
    appName: 'Sokobanko',
    // Your app's rows about the user, from your server.
    exportApp: () => fetch('/api/me/export').then((r) => r.json()),
  },
)

yourData.subscribe((state) => render(state)) // idle, exporting, confirming, deleting, deleted, empty, failed
const file = await yourData.exportData() // { filename, json }: offer it as a download
yourData.askDelete() // show the confirmation
await yourData.confirmDelete() // deletes the account, and the app's rows with it

Deleting goes through the user pool, and your tables' on delete cascade keys to auth.users remove your app's rows: your app needs no delete code.

Counting visits

import { createAnalyticsChoice } from '@kodentuzo/spotstrap/blocks'
import { analytics } from '@kodentuzo/spotkit/client'

const choice = createAnalyticsChoice(await analytics())
choice.promptVisible // opt-in only: show the prompt until the visitor answers
choice.switchVisible // show a "Count my visits" switch, in Your data
choice.accept() // or decline(), or setOn(true | false)

Local-first

For apps that save on the device first and sync through an outbox (the ecosystem's local-first page):

  • syncStatus({ pending, online, remote, failed }) returns { state, pending, text, help }: saved-here (the data stays on this device), syncing, synced, offline or failed (something the server refused, which won't retry by itself). Feed it from the outbox's pending count and navigator.onLine. The Vue view SyncStatus takes the same props, announces changes politely to screen readers, and emits retry when it failed.
  • StoredHere explains it in two sentences, with the app's name, and points to Your data.
  • Your data's wording covers what is kept on this device. spotkit's localData() exports and clears it.

Wording

Everything the blocks say is in en (Messages). Pass messages to use your own wording or another language; a translation has the same shape, so it can't miss a sentence. The wording is a legal text in plain words: have it read by a lawyer once.

Clone this wiki locally