AppKit Overview
AppKit is the recommended way to build Databricks Apps - provides type-safe SQL queries, React components, and seamless deployment.
Workflow
- Scaffold: Run
databricks apps manifest, thendatabricks apps initwith--featuresand--setas in parent SKILL.md (App Manifest and Scaffolding) - Develop:
cd <NAME> && npm install && npm run dev - Validate:
databricks apps validate - Deploy:
databricks apps deploy --profile <PROFILE>
Data Discovery (Before Writing SQL)
Use the parent databricks skill for data discovery (table search, schema exploration, query execution).
Pre-Implementation Checklist
Before writing App.tsx, complete these steps:
- ✅ Create SQL files in
config/queries/ - ✅ Run
npm run typegento generate query types - ✅ Read
client/src/appKitTypes.d.tsto see available query result types - ✅ Verify component props via
npx @databricks/appkit docs(check the relevant component page) - ✅ Plan smoke test updates (default expects "Minimal Databricks App")
DO NOT write UI code until types are generated and verified.
Post-Implementation Checklist
Before running databricks apps validate:
- ✅ Update
tests/smoke.spec.tsheading selector to match your app title - ✅ Update or remove the 'hello world' text assertion
- ✅ Verify
npm run typegenhas been run after all SQL files are finalized - ✅ Ensure all numeric SQL values use
Number()conversion in display code
Project Structure
my-app/
├── server/
│ ├── server.ts # Backend entry point (AppKit)
│ └── .env # Optional local dev env vars (do not commit)
├── client/
│ ├── index.html
│ ├── vite.config.ts
│ └── src/
│ ├── main.tsx
│ └── App.tsx # <- Main app component (start here)
├── config/
│ └── queries/
│ └── my_query.sql # -> queryKey: "my_query"
├── app.yaml # Deployment config
├── package.json
└── tsconfig.json
Key files to modify:
| Task | File |
|---|---|
| Build UI | client/src/App.tsx |
| Add SQL query | config/queries/<NAME>.sql |
| Add API endpoint | server/server.ts (tRPC) |
| Add shared helpers (optional) | create shared/types.ts or client/src/lib/formatters.ts |
| Fix smoke test | tests/smoke.spec.ts |
Type Safety
For type generation details, see: npx @databricks/appkit docs ./docs/docs/development/type-generation.md
Quick workflow:
- Add/modify SQL in
config/queries/ - Run
npm run typegen - Types appear in
client/src/appKitTypes.d.ts
Adding Visualizations
Step 1: Create SQL file config/queries/my_data.sql
SELECT category, COUNT(*) as count FROM my_table GROUP BY category
Step 2: Use component (types auto-generated!)
import { BarChart } from '@databricks/appkit-ui/react';
<BarChart queryKey="my_data" parameters={{}} />
AppKit Official Documentation
Always use AppKit docs as the source of truth for API details. Run npx @databricks/appkit docs (no args) to see the full index, then navigate to specific pages. Do not guess paths.
References
| When you're about to... | Read |
|---|---|
| Write SQL files | SQL Queries — parameterization, dialect, sql.* helpers |
Use useAnalyticsQuery |
AppKit SDK — memoization, conditional queries |
| Add chart/table components | Frontend — component quick reference, anti-patterns |
| Add API mutation endpoints | tRPC — only if you need server-side logic |
Critical Rules
- SQL for data retrieval: Use
config/queries/+ visualization components. Never tRPC for SELECT. - Numeric types: SQL numbers may return as strings. Always convert:
Number(row.amount) - Type imports: Use
import type { ... }(verbatimModuleSyntax enabled). - Charts are ECharts: No Recharts children - use props (
xKey,yKey,colors). - Conditional queries: Use
autoStart: falseoption or conditional rendering to control query execution.
Decision Tree
- Display data from SQL?
- Chart/Table →
BarChart,LineChart,DataTablecomponents - Custom layout (KPIs, cards) →
useAnalyticsQueryhook
- Chart/Table →
- Call Databricks API? → tRPC (serving endpoints, MLflow, Jobs)
- Modify data? → tRPC mutations