# appshare Bootstrap lane instructions Use this lane for most appshare mini apps. Reference implementation: `examples/pending-incidents/` in the repository. It is the Bootstrap golden path and includes static frontend files, Project Functions, table schema, runtime policy, seed data, publish payload, and import job mapping. ## Stack - HTML. - CSS. - Vanilla JavaScript. - Bootstrap 5, themed by appshare. - `/sdk/appshare.js`. - `/sdk/appshare-ui.js`. - `/sdk/appshare-icons.js` (icons, when the app needs any). Do not use React, Preact, Alpine, Tailwind, shadcn, npm packages, bundlers, or build steps in this lane. ## When to use Use this lane for: - CRUD apps. - Dashboards. - Forms. - Master-detail flows of moderate complexity. - Detail modals. - Tables, filters, tabs, alerts, toasts, and ordinary dropdowns. - Product search by EAN or name when `as-combobox` is enough. Escalate to the React lane only when the app has complex local state, nested views, rich editing, drag/drop, or many reusable interactive components. ## Required scripts ```html ``` Use the appshare-provided Bootstrap CSS URL when the deployment template exposes one. If the artifact must be fully standalone, inline or publish the approved Bootstrap 5 CSS with the app instead of adding a random CDN dependency. ## Appshare SDK Create one client: ```js const appshare = Appshare.create({ projectId: "prj_...", environment: "dev" }); ``` Prefer server-side functions for business logic: ```js const response = await appshare .function("mis_incidencias_pendientes") .invoke({ limit: 50 }); ``` Use direct tables only for simple UI state or trusted project workflows: ```js const rows = await appshare.table("incidents").list({ limit: 100 }); ``` To seed or bulk-load many rows, use a `table_import` job (`jobs().create(...)` or `create_project_job`), never a loop of `create_table_row` — looping rewrites the whole project store per row. Pass the dataset inline as `source.content` (a JSON array or CSV, job payload limit 5MB) or from a storage object via `source.bucket`/`source.key` (object limit 10MB); `table_import` validates and writes the whole batch in one store write and one SQLite transaction (up to `APPSHARE_PROJECT_JOB_MAX_IMPORT_ROWS`, default 100000; see `/llms/tables.txt` for column aliases, number/date formats and who may import). To load several existing tables from one upload, use a `table_import_zip` job: upload a zip (with `put_storage_object`) holding a `manifest.json` (`tables` array of `file`/`table`/`mapping` entries) plus the data files, then point the job at it via `source.bucket`/`source.key`. Pass `wait: true` when creating an import job to run it inline and get the finished result in one call instead of polling `get_project_job`. To read an external API (e.g. HR), an admin sets up an org-level connector that holds the credential once and grants access per person/role; apps call it live with `appshare.connector(name).call(module)` (token stays server-side) or sync it into a table with a `table_import` job using `source.connector`/`source.module`. ## Reports and shared data queries Read the topics `/llms/data-queries.txt` ("Data queries and report correctness") and `/llms/quality.txt` ("Asynchronous app quality") before building or optimizing a report. Discover existing saved queries with `list_project_queries` / `get_project_query` before defining a new one. For Madrid calendar or booking apps, also read `/llms/calendar.txt` and `/llms/reservations.txt` before implementing date or reservation behavior. To book Metrica meeting rooms in Outlook, read `/llms/rooms.txt` ("Microsoft 365 meeting rooms"): it is `ctx.rooms`, only inside Project Functions, never Graph from the browser. To add events to or cancel meetings in an employee's Outlook calendar, read `/llms/employee-calendars.txt`: it is `ctx.calendar`, also only inside Project Functions, and the project needs a grant from a platform admin. Use the same SDK client in this lane: ```js // Only after confirming this named query exists in the project/environment: const summary = await appshare.runQuery("orders_by_status", {status: "open"}); const groups = summary.result.rows; // For detail, choose fields and a bounded page: const page = await appshare.table("orders").listPage({ fields: ["status", "amount"], limit: 100 }); ``` `table.aggregate()` handles SQL counts/sums/groups; Project Functions handle custom or multi-table rules. `list()` returns a single array page, never all rows. Preserve `data_revision` when paging; restart on 409. Reuse the summary revision when loading matching detail. Keep row/field permissions on the server and inspect errors. Do not download entire tables just to count them. Keep full dates until date cutoffs are applied. Compare KPIs, history and exports against the current published source; a successful request or quality job does not establish numeric equivalence. A separate test app in the same environment shares the original tables, so isolate write targets for editable tests. Inspect `get_app_quality` after publication and associate form labels with inputs; review proper-name spelling flags manually. ## Bootstrap rules - Use Bootstrap layout and components before inventing custom UI. - Use modals for detail editors. - Use `table`, `list-group`, `form-control`, `btn`, `badge`, `alert`, `toast`, `nav-tabs`, and `card` sparingly and consistently. - Keep CSS local and small. - Do not create a separate design system per app. - Do not place business rules in the browser when a project function can return the safe result. ## Icons appshare self-hosts a curated icon set (Lucide geometry, ~100 icons, same icons the console uses). Load it and use it — do NOT add lucide, Bootstrap Icons, Font Awesome, Material Symbols or any icon CDN, and do not paste raw `` paths into the page: ```html ``` Static markup — the custom element, or a `data-icon` placeholder (both render inline SVG, inherit `currentColor` and default to `1em`, so they size with the surrounding text): ```html ``` Dynamic markup (list renderers, template literals) — ask for the SVG string: ```js row.innerHTML = ` ${task.title} `; ``` - ``: `size` any CSS length (default `1em`), `label` sets the accessible name (without it the icon is `aria-hidden`, which is what you want next to visible text). All attributes are observed. - `AppshareIcons.markup(name, options)` returns the `` string; `AppshareIcons.svg(name, options)` returns the element; `AppshareIcons.createIcons(root)` renders `[data-icon]` placeholders added after load (it runs once automatically on `DOMContentLoaded`); `AppshareIcons.names` lists every icon; `AppshareIcons.has(name)` checks one. - The full name list is `GET /sdk/appshare-icons.svg` (one `` per icon; that sprite is also usable directly with ``, but prefer the script — it needs no extra request and styles reliably). - Names are lucide names in kebab-case: `plus`, `search`, `trash-2`, `pencil`, `check`, `x`, `refresh-cw`, `download`, `upload`, `filter`, `calendar`, `clock`, `user`, `users`, `mail`, `file-text`, `folder`, `table`, `database`, `chart-column`, `triangle-alert`, `circle-check`, `circle-alert`, `info`, `settings`, `external-link`, `eye`, `lock`, `loader-circle`, `sparkles`, `star`, `bookmark`, `arrow-left`, `chevron-down`… - If an icon you need is not in the set, use the closest one that IS in the set and tell the user the set can be extended (add the name to `scripts/gen_appshare_icons.mjs` and regenerate) — never fall back to a CDN. - NEVER use an emoji or a unicode character as an icon (✅ ⚠️ 🔒 ✓ ✕ ☐ ⬜ ▾ ▸), and that includes hiding one in an HTML entity (`✓`) or a CSS escape (`content: "\2713"`). Reason: apps get printed, and Metrica's brand fonts (Roboto, Cormorant) do not contain those characters — on screen the browser silently falls back to a system font, but in a PDF the generator embeds LucidaGrande / ZapfDingbats / AppleColorEmoji, and on a Linux runner none of them exists, so it prints a box. An inline SVG becomes vector paths: identical on screen, on paper and on any machine. If a `::before`/`::after` needs a shape, use `mask` with an inline `data:image/svg+xml` so the colour still comes from the token. ## Search dropdown Bootstrap does not include a searchable dropdown. Use appshare's official combobox: ```html ``` ```js AppshareUI.combobox("#productSearch", { minLength: 2, search: async (query) => { const response = await appshare .function("buscar_producto") .invoke({ query }); return response.result.products.map((product) => ({ value: product.id, label: `${product.ean} · ${product.name}`, meta: product.price })); }, onSelect: (product) => { addOrderLine(product); } }); ``` The combobox supports debounce, loading state, empty state, mouse selection, ArrowUp, ArrowDown, Enter, and Escape. ## Project app index (project home pages) If the project has `toolbar_mode` set and one app is marked `is_default` (its landing page), render that app's index with appshare's official component instead of hand-writing a fetch against `/api/public-site-index/{project}`: ```html ``` `layout` is `thumbnail` (card grid with a live iframe preview per app) or `list` (compact rows). All attributes are observed live. It applies the same viewer-filtered, `hide_from_index`-excluding visibility as the project site toolbar's own "Apps" flyout. ## Collapsible document control For reports, guides and other governed documents, use AppShare's native tag instead of copying a hand-built metadata panel. AppShare loads the component automatically; no script or component CSS is needed: ```html ``` It starts collapsed and shows status plus version in its summary. Add the boolean `open` attribute to start expanded. Missing attributes are omitted. ## Master-detail pattern For a master-detail editor: - List orders in a Bootstrap table. - Open the selected order in a Bootstrap modal. - Keep all modal state in one plain object. - Use a saved query or table.aggregate for a single-table summary; use a Project Function for a multi-table aggregate view. - Use a project function for saving a full order with lines when validation matters. - Use `as-combobox` for EAN/product lookup. ## Forbidden in this lane - Installing dependencies. - Using Alpine directives. - Using React/Preact. - Calling raw REST routes when the Appshare SDK has a wrapper. - Reading or exposing secrets in browser code. - Loading an icon library or icon font from a CDN, or inlining raw SVG paths, instead of `/sdk/appshare-icons.js`. - Using emoji or unicode characters as icons — directly, or hidden in an HTML entity or a CSS escape. - Recreating combobox, modal, toast, table, or form primitives from scratch.