Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"!docs/.docusaurus",
"!**/*.gen.css",
"!**/*.gen.ts",
"!**/typedoc-sidebar.ts"
"!**/typedoc-sidebar.ts",
"!**/template"
]
},
"formatter": {
Expand Down
7 changes: 7 additions & 0 deletions template/.env.example.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DATABRICKS_HOST=https://...
{{- if .dotenv_example}}
{{.dotenv_example}}
{{- end}}
DATABRICKS_APP_PORT=8000
DATABRICKS_APP_NAME=minimal
FLASK_RUN_HOST=0.0.0.0
7 changes: 7 additions & 0 deletions template/.env.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{if ne .profile ""}}DATABRICKS_CONFIG_PROFILE={{.profile}}{{else}}DATABRICKS_HOST={{workspace_host}}{{end}}
{{- if .dotenv}}
{{.dotenv}}
{{- end}}
DATABRICKS_APP_PORT=8000
DATABRICKS_APP_NAME={{.project_name}}
FLASK_RUN_HOST=0.0.0.0
10 changes: 10 additions & 0 deletions template/.gitignore.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
node_modules/
client/dist/
dist/
build/
.env
.databricks/
.smoke-test/
test-results/
playwright-report/
36 changes: 36 additions & 0 deletions template/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dependencies
node_modules

# Build outputs
dist
build
client/dist
.next
.databricks/

# Environment files
.env
.env.local
.env.*.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage
coverage

# Cache
.cache
.turbo

# Lock files
package-lock.json
yarn.lock
pnpm-lock.yaml

# Vendor
vendor
12 changes: 12 additions & 0 deletions template/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf",
"bracketSpacing": true,
"jsxSingleQuote": false
}
183 changes: 183 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Minimal Databricks App

A minimal Databricks App powered by Databricks AppKit, featuring React, TypeScript, tRPC, and Tailwind CSS.

## Prerequisites

- Node.js 18+ and npm
- Databricks CLI (for deployment)
- Access to a Databricks workspace

## Databricks Authentication

### Local Development

For local development, configure your environment variables by creating a `.env` file:

```bash
cp env.example .env
```

Edit `.env` and set the following:

```env
DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
DATABRICKS_WAREHOUSE_ID=your-warehouse-id
DATABRICKS_APP_PORT=8000
```

### CLI Authentication

The Databricks CLI requires authentication to deploy and manage apps. Configure authentication using one of these methods:

#### OAuth U2M

Interactive browser-based authentication with short-lived tokens:

```bash
databricks auth login --host https://your-workspace.cloud.databricks.com
```

This will open your browser to complete authentication. The CLI saves credentials to `~/.databrickscfg`.

#### Configuration Profiles

Use multiple profiles for different workspaces:

```ini
[DEFAULT]
host = https://dev-workspace.cloud.databricks.com

[production]
host = https://prod-workspace.cloud.databricks.com
client_id = prod-client-id
client_secret = prod-client-secret
```

Deploy using a specific profile:

```bash
databricks bundle deploy -t prod --profile production
```

**Note:** Personal Access Tokens (PATs) are legacy authentication. OAuth is strongly recommended for better security.

## Getting Started

### Install Dependencies

```bash
npm install
```

### Development

Run the app in development mode with hot reload:

```bash
npm run dev
```

The app will be available at the URL shown in the console output.

### Build

Build both client and server for production:

```bash
npm run build
```

This creates:

- `dist/server/` - Compiled server code
- `client/dist/` - Bundled client assets

### Production

Run the production build:

```bash
npm start
```

## Code Quality

```bash
# Type checking
npm run typecheck

# Linting
npm run lint
npm run lint:fix

# Formatting
npm run format
npm run format:fix
```

## Deployment with Databricks Asset Bundles

### 1. Configure Bundle

Update `databricks.yml` with your workspace settings:

```yaml
targets:
dev:
workspace:
host: https://your-workspace.cloud.databricks.com
variables:
warehouse_id: your-warehouse-id
```

### 2. Validate Bundle

```bash
databricks bundle validate
```

### 3. Deploy

Deploy to the development target:

```bash
databricks bundle deploy -t dev
```

### 4. Run

Start the deployed app:

```bash
databricks bundle run <APP_NAME> -t dev
```

### Deploy to Production

1. Configure the production target in `databricks.yml`
2. Deploy to production:

```bash
databricks bundle deploy -t prod
```

## Project Structure

```
* client/ # React frontend
* src/ # Source code
* public/ # Static assets
* server/ # Express backend
* server.ts # Server entry point
* trpc.ts # tRPC router
* shared/ # Shared types
* databricks.yml # Bundle configuration
```

## Tech Stack

- **Frontend**: React 19, TypeScript, Vite, Tailwind CSS
- **Backend**: Node.js, Express, tRPC
- **UI Components**: Radix UI, shadcn/ui
- **Databricks**: App Kit SDK, Analytics SDK
5 changes: 5 additions & 0 deletions template/app.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
command: ['npm', 'run', 'start']
{{- if .app_env}}
env:
{{.app_env}}
{{- end}}
21 changes: 21 additions & 0 deletions template/client/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
18 changes: 18 additions & 0 deletions template/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="48x48" href="/favicon-48x48.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.project_name}}</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions template/client/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {},
},
};
Binary file added template/client/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/client/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/client/public/favicon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/client/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/client/public/favicon-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/client/public/favicon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions template/client/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions template/client/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "{{.project_name}}",
"short_name": "{{.project_name}}",
"icons": [
{
"src": "/favicon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/favicon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Loading