# Templates

Opinionated, copy-pasteable templates for building on Databricks.

- [AI Chat App](https://developers.databricks.com/templates/ai-chat-app.md): Model Serving integration, AI SDK streaming chat, and Lakebase-persisted chat history.
- [App with Lakebase](https://developers.databricks.com/templates/app-with-lakebase.md): Wire up a Databricks App with Lakebase for persistent data storage. Includes schema setup and full CRUD API routes.
- [Genie Analytics App](https://developers.databricks.com/templates/genie-analytics-app.md): Build a minimal Databricks App with AI/BI Genie conversational analytics. Covers Genie space configuration, plugin wiring, and deploy.
- [Lakebase Off-Platform](https://developers.databricks.com/templates/lakebase-off-platform.md): Use Lakebase from apps hosted outside Databricks App Platform (for example on AWS, Vercel, or Netlify) with portable env, token, and Drizzle patterns.
- [Operational Data Analytics](https://developers.databricks.com/templates/operational-data-analytics.md): End-to-end setup for analyzing operational database data in the lakehouse: Unity Catalog with external storage, Lakebase provisioning, Lakehouse Sync CDC replication, and a medallion architecture pipeline with silver and gold layers.
- [Set Up Your Local Dev Environment](https://developers.databricks.com/templates/set-up-your-local-dev-environment.md): Install the Databricks CLI, authenticate a profile, and verify the handshake. The strict prerequisite for every other DevHub recipe and template.
- [Spin Up a Databricks App](https://developers.databricks.com/templates/spin-up-databricks-app.md): Scaffold a fresh AppKit Databricks App with `databricks apps init`, run it locally, and deploy to your workspace.
- [Onboard Your Coding Agent](https://developers.databricks.com/templates/onboard-your-coding-agent.md): Install Databricks agent skills (project-scoped), wire up the DevHub Docs MCP server, and bootstrap an AGENTS.md so your coding assistant knows this repo's workspace defaults.
- [Create a Lakebase Instance](https://developers.databricks.com/templates/lakebase-create-instance.md): Provision a managed Lakebase Postgres project on Databricks and collect the connection values needed by downstream templates.
- [Lakebase Data Persistence](https://developers.databricks.com/templates/lakebase-data-persistence.md): Add a managed Postgres database to your Databricks app using the Lakebase plugin. Covers schema setup, table creation, and full CRUD REST API routes.
- [Lakebase pgvector](https://developers.databricks.com/templates/lakebase-pgvector.md): Enable vector similarity search in Lakebase using the pgvector extension. Covers extension setup, vector table design, insert and cosine retrieval helpers, and IVFFlat/HNSW index options.
- [Query AI Gateway Endpoints](https://developers.databricks.com/templates/foundation-models-api.md): Query AI Gateway endpoints for production-ready access to foundation models with built-in governance.
- [Generate Embeddings with AI Gateway](https://developers.databricks.com/templates/embeddings-generation.md): Generate text embeddings from a Databricks AI Gateway endpoint using the Databricks SDK.
- [Create a Databricks Model Serving endpoint](https://developers.databricks.com/templates/model-serving-endpoint-creation.md): Create and validate a Databricks Model Serving endpoint for AI chat inference in Databricks Apps.
- [Streaming AI Chat with Model Serving](https://developers.databricks.com/templates/ai-chat-model-serving.md): Build a streaming AI chat experience using AI SDK and Databricks Model Serving endpoints.
- [Lakebase Agent Memory](https://developers.databricks.com/templates/lakebase-agent-memory.md): Persist your AI agent's chat sessions and messages in Lakebase so users can resume conversations and your agent can reason over prior turns across deploys.
- [Lakebase Change Data Feed: Sync Lakebase to Unity Catalog (Autoscaling)](https://developers.databricks.com/templates/lakebase-change-data-feed-autoscaling.md): Replicate Lakebase Autoscaling Postgres tables into Unity Catalog as managed Delta tables using Lakehouse Sync, with CDC and SCD Type 2 history.
- [Sync Tables: Unity Catalog to Lakebase (Autoscaling)](https://developers.databricks.com/templates/sync-tables-autoscaling.md): Sync Unity Catalog tables into Lakebase Autoscaling Postgres as synced tables for sub-10ms application queries, with snapshot, triggered, or continuous modes.
- [Set Up Unity Catalog with External Storage](https://developers.databricks.com/templates/unity-catalog-setup.md): Create a Unity Catalog catalog backed by an external S3 bucket with storage credentials, external location, and a schema ready for lakehouse tables.
- [Genie Conversational Analytics](https://developers.databricks.com/templates/genie-conversational-analytics.md): Embed a Databricks AI/BI Genie chat interface so users can explore data through natural language. Configure a Genie space, wire up server and client plugins, declare app resources, and deploy.
- [Genie Multi-Space Selector](https://developers.databricks.com/templates/genie-multi-space.md): Add a space selector so users can switch between multiple AI/BI Genie spaces from a single page. Covers multi-alias server config, per-space bundle resources, and automatic conversation cleanup on space switch and redeployment.
- [Medallion Architecture from CDC History Tables](https://developers.databricks.com/templates/medallion-architecture-from-cdc.md): Transform Lakehouse Sync CDC history tables into a medallion architecture with silver (current state) and gold (aggregations) layers using Lakeflow Declarative Pipelines.
- [Lakebase Env Management for Off-Platform Apps](https://developers.databricks.com/templates/lakebase-off-platform-env-management.md): Define and validate cross-platform environment variables for Lakebase-backed apps deployed outside Databricks App Platform.
- [Lakebase Token Management](https://developers.databricks.com/templates/lakebase-token-management.md): Implement cached workspace and Lakebase credential token flows for secure Postgres access in off-platform deployments.
- [Drizzle + Lakebase in an Off-Platform App](https://developers.databricks.com/templates/lakebase-drizzle-off-platform.md): Connect Drizzle ORM to Lakebase with pg password callbacks and migration-time temporary DATABASE_URL credentials.
- [Volume File Manager](https://developers.databricks.com/templates/volume-file-upload.md): Add file upload, browsing, download, delete, file type validation, and CSV row preview to your Databricks app using Unity Catalog Volumes.
- [Agentic Support Console](https://developers.databricks.com/templates/agentic-support-console.md): End-to-end AI-powered support console combining Lakebase, Lakehouse Sync, a medallion pipeline, an LLM agent job, reverse sync, and a Databricks App with Genie analytics.
- [Vacation Rentals Operations Console](https://developers.databricks.com/templates/vacation-rentals.md): Vacation rental ops dashboard with revenue analytics from a SQL Warehouse, a booking queue with Lakebase-backed flags and agent notes, and an embedded Genie chat panel.
- [SaaS Subscription Tracker](https://developers.databricks.com/templates/saas-tracker.md): Internal tool for tracking team SaaS subscriptions, owners, costs, and renewals with Lakebase persistence and Genie spend analytics.
- [Content Moderator](https://developers.databricks.com/templates/content-moderator.md): Internal content moderation tool with per-channel guidelines, AI-powered compliance scoring via Model Serving, and a moderator review workflow backed by Lakebase and Genie analytics.
- [Inventory Intelligence](https://developers.databricks.com/templates/inventory-intelligence.md): Retail inventory management with AI-powered demand forecasting, replenishment recommendations, and optional Genie analytics. Built on a live medallion pipeline synced to Lakebase.
- [RAG Chat App](https://developers.databricks.com/templates/rag-chat.md): Streaming Retrieval-Augmented Generation chat app with pgvector retrieval from Lakebase, Wikipedia seed corpus, Model Serving generation, and Lakebase-backed chat history. Consumed via `databricks apps init`.
