{"title":"Develop locally","description":"Use the Altertable data-app CLI and SDK workflow when you need local source files, a development server, and control over publishing a data app.","order":300,"askSuggestions":["How do I publish a local data app?","Why does my query fail lakehouse validation?","How do I build a data app locally with my coding agent?"],"navigation":true,"body":{"code":"var Component=(()=>{var u=Object.create;var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var b=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),y=(n,e)=>{for(var l in e)r(n,l,{get:e[l],enumerable:!0})},c=(n,e,l,t)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of g(e))!w.call(n,i)&&i!==l&&r(n,i,{get:()=>e[i],enumerable:!(t=f(e,i))||t.enumerable});return n};var v=(n,e,l)=>(l=n!=null?u(m(n)):{},c(e||!n||!n.__esModule?r(l,\"default\",{value:n,enumerable:!0}):l,n)),k=n=>c(r({},\"__esModule\",{value:!0}),n);var s=b((T,d)=>{d.exports=_jsx_runtime});var D={};y(D,{default:()=>h,frontmatter:()=>x});var a=v(s()),x={title:\"Develop locally\",description:\"Use the Altertable data-app CLI and SDK workflow when you need local source files, a development server, and control over publishing a data app.\",order:300,askSuggestions:[\"How do I publish a local data app?\",\"Why does my query fail lakehouse validation?\",\"How do I build a data app locally with my coding agent?\"]};function p(n){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...n.components},{DocsPreviewDocument:l,DocsPreviewSection:t,DocsPrompt:i}=e;return l||o(\"DocsPreviewDocument\",!0),t||o(\"DocsPreviewSection\",!0),i||o(\"DocsPrompt\",!0),(0,a.jsxs)(l,{anchors:\"develop-locally directory-app-workflow 1-create-a-local-app 2-run-the-development-server 3-validate-the-app single-file-preview-and-publishing troubleshooting build-locally-with-your-coding-agent\",children:[(0,a.jsxs)(t,{sectionId:\"develop-locally\",sectionTitle:\"Develop locally\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,a.jsx)(e.h1,{id:\"develop-locally\",children:\"Develop locally\"}),`\n`,(0,a.jsxs)(e.p,{children:[\"Start with \",(0,a.jsx)(e.a,{href:\"/docs/data-apps/build\",children:\"Build a data app\"}),\" for a hosted app. Use local development when you need source files, a local server, or control over publishing.\"]}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"directory-app-workflow\",sectionTitle:\"Directory app workflow\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,a.jsx)(e.h2,{id:\"directory-app-workflow\",children:\"Directory app workflow\"}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"1-create-a-local-app\",sectionTitle:\"1. Create a local app\",anchors:\"\",ancestors:\"directory-app-workflow\",index:\"2\",children:[(0,a.jsx)(e.h3,{id:\"1-create-a-local-app\",children:\"1. Create a local app\"}),`\n`,(0,a.jsxs)(e.p,{children:[(0,a.jsx)(e.a,{href:\"/docs/lakehouse/clients/cli\",children:\"Install the CLI and log in\"}),\", then create a scaffold:\"]}),`\n`,(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-altertable\",children:`altertable app create product-pulse\n`})}),`\n`,(0,a.jsx)(e.p,{children:\"The scaffold checks the live connection. Confirm that the active profile points to the intended environment before continuing.\"}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"2-run-the-development-server\",sectionTitle:\"2. Run the development server\",anchors:\"\",ancestors:\"directory-app-workflow\",index:\"3\",children:[(0,a.jsx)(e.h3,{id:\"2-run-the-development-server\",children:\"2. Run the development server\"}),`\n`,(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-bash\",children:`cd product-pulse\naltertable app dev\n`})}),`\n`,(0,a.jsxs)(e.p,{children:[\"Open the local URL printed by the command. Edit the scaffold's \",(0,a.jsx)(e.code,{children:\"src/main.tsx\"}),\" and \",(0,a.jsx)(e.code,{children:\"App.tsx\"}),\" source and verify a bounded query against a known table. Check loading, empty, and error states as well as a successful result.\"]}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"3-validate-the-app\",sectionTitle:\"3. Validate the app\",anchors:\"\",ancestors:\"directory-app-workflow\",index:\"4\",children:[(0,a.jsx)(e.h3,{id:\"3-validate-the-app\",children:\"3. Validate the app\"}),`\n`,(0,a.jsx)(e.p,{children:\"From the project directory, run:\"}),`\n`,(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-altertable\",children:`altertable app lint --lakehouse\naltertable app build\n`})}),`\n`,(0,a.jsxs)(e.p,{children:[\"The lakehouse check validates queries against the connected environment. Compare at least one displayed metric with a direct SQL result before publishing. For all options, see the \",(0,a.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-app\",children:\"app command reference\"}),\".\"]}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"single-file-preview-and-publishing\",sectionTitle:\"Single-file preview and publishing\",anchors:\"\",ancestors:\"\",index:\"5\",children:[(0,a.jsx)(e.h2,{id:\"single-file-preview-and-publishing\",children:\"Single-file preview and publishing\"}),`\n`,(0,a.jsxs)(e.p,{children:[\"The CLI also supports a separate single-file workflow. Author a self-contained React source file using the \",(0,a.jsx)(e.a,{href:\"https://github.com/altertable-ai/data-app\",children:\"data-app SDK\"}),\", then preview and validate that file:\"]}),`\n`,(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-altertable\",children:`altertable app dev --file index.tsx\naltertable app lint --file index.tsx --lakehouse\n`})}),`\n`,(0,a.jsx)(e.p,{children:\"Publishing creates a hosted app in the active environment. Review the source, title, target environment, and local preview before running:\"}),`\n`,(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-altertable\",children:`altertable app publish --title 'Product pulse' --file index.tsx\n`})}),`\n`,(0,a.jsxs)(e.p,{children:[(0,a.jsx)(e.code,{children:\"app publish --file\"}),\" uploads a single source file; it does not upload the directory scaffold or its build output. Use \",(0,a.jsx)(e.a,{href:\"/docs/data-apps/build\",children:\"hosted app building\"}),\" when you want Altertable to manage the app source and publishing.\"]}),`\n`,(0,a.jsxs)(e.p,{children:[\"Follow the printed result URL and repeat the metric and interaction checks in the hosted app, then \",(0,a.jsx)(e.a,{href:\"/docs/data-apps/share\",children:\"configure sharing\"}),\". Use the \",(0,a.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-app-update\",children:\"update command\"}),\" to change an existing app.\"]}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"troubleshooting\",sectionTitle:\"Troubleshooting\",anchors:\"\",ancestors:\"\",index:\"6\",children:[(0,a.jsx)(e.h2,{id:\"troubleshooting\",children:\"Troubleshooting\"}),`\n`,(0,a.jsxs)(e.ul,{children:[`\n`,(0,a.jsxs)(e.li,{children:[(0,a.jsx)(e.strong,{children:\"Scaffold connection check fails:\"}),\" run \",(0,a.jsx)(e.code,{children:\"altertable profile show\"}),\" and verify a query with the same profile.\"]}),`\n`,(0,a.jsxs)(e.li,{children:[(0,a.jsx)(e.strong,{children:\"A query fails validation:\"}),\" inspect the real catalog and column names; qualify tables with catalog and schema.\"]}),`\n`,(0,a.jsxs)(e.li,{children:[(0,a.jsx)(e.strong,{children:\"The preview is empty:\"}),\" query the source directly with the same filters and time range.\"]}),`\n`,(0,a.jsxs)(e.li,{children:[(0,a.jsx)(e.strong,{children:\"Publishing fails:\"}),\" check the entry file and the active environment, then inspect the command's error before retrying.\"]}),`\n`]}),`\n`,(0,a.jsxs)(e.p,{children:[\"Follow the \",(0,a.jsx)(e.a,{href:\"https://github.com/altertable-ai/data-app\",children:\"data-app repository\"}),\" for the CLI scaffold, SDK setup, development commands, and publishing workflow. Use its current instructions for the SDK version in your project.\"]}),`\n`,(0,a.jsx)(e.p,{children:\"If you are working with an agent, ask it to use Altertable's local data-app workflow explicitly and verify the app locally before publishing.\"}),`\n`]}),(0,a.jsxs)(t,{sectionId:\"build-locally-with-your-coding-agent\",sectionTitle:\"Build locally with your coding agent\",anchors:\"\",ancestors:\"\",index:\"7\",children:[(0,a.jsx)(e.h2,{id:\"build-locally-with-your-coding-agent\",children:\"Build locally with your coding agent\"}),`\n`,(0,a.jsx)(i,{children:(0,a.jsx)(e.pre,{children:(0,a.jsx)(e.code,{className:\"language-text\",children:`Build an Altertable data app locally in this repository. Read https://altertable.ai/docs/data-apps/local-development.md and the current instructions in https://github.com/altertable-ai/data-app first.\n\nInspect the project and use its package manager. Infer which question the app should answer and who will use it from the project context; ask only for missing details. Confirm the target Altertable environment, inspect available catalogs and schemas, and agree on the metric definitions and time range.\n\nCreate or reuse the local scaffold and implement a small working app with bounded queries, useful filters, and clear loading, empty, and error states. Keep credentials out of browser code and source control. Verify the query results and calculations against actual data, then run the supported validation and build commands and inspect the app locally.\n\nLeave the source and local preview ready for review. Report how to run it, the data sources used, and any remaining issues. Do not publish, deploy, or share the app.\n`})})})]})]})}function h(n={}){let{wrapper:e}=n.components||{};return e?(0,a.jsx)(e,{...n,children:(0,a.jsx)(p,{...n})}):p(n)}function o(n,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+n+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return k(D);})();\n;return Component;"},"_id":"docs/data-apps/local-development.mdx","_raw":{"sourceFilePath":"docs/data-apps/local-development.mdx","sourceFileName":"local-development.mdx","sourceFileDir":"docs/data-apps","contentType":"mdx","flattenedPath":"docs/data-apps/local-development"},"type":"Docs","path":"/data-apps/local-development","level":2,"parent":"data-apps"}