Directory Architecture
databricks-apps-survey-analysis/
โโโ .github/workflows/deploy.yml # Deploys on push to main/stg/prd
โโโ .husky/pre-commit # format:check + lint (the hook that actually runs)
โโโ README.md # Setup and troubleshooting
โโโ nodejs-fastapi-hello-world-app/ # The app itself (run every command here)
โโโ backend/
โ โโโ main.py # Router registration + SPA catch-all
โ โโโ settings.py # Resolves env vars from .env / yaml
โ โโโ databricks_workspace.py # Builds the WorkspaceClient
โ โโโ generate_models_from_databricks.py # Generates Pydantic models from UC schemas
โ โโโ models/ # Pydantic models
โ โโโ routes/ # FastAPI routers (thin layer)
โ โโโ sql/ # SQL queries and Databricks connection
โ โโโ static/ # Built frontend (tracked in git)
โโโ frontend/
โ โโโ vite.config.ts # outDir=backend/static, proxies /api to :8000
โ โโโ src/
โ โโโ api/generated/ # orval-generated client (never hand-edit)
โ โโโ components/ # <category>/<Name>/index.tsx + index.scss
โ โโโ pages/ # <Name>/index.tsx + index.scss
โ โโโ constants/ # dwh.ts (fixed catalog/schema), navigation.ts
โโโ scripts/
โ โโโ generate_openapi.py # Dumps openapi.yaml from the FastAPI app
โ โโโ setup-husky.mjs # Points husky's install target at the repo root
โโโ _templates/component/new/ # hygen component scaffolds
โโโ app.yaml # Databricks Apps config (DATABRICKS_HTTP_PATH)
โโโ databricks.yml # Asset Bundle config (workspace.host)
โโโ package.json
โโโ requirements.txt
Directory Descriptions
| Directory | Description |
|---|---|
backend/routes/ |
FastAPI routers. A thin layer that calls the synchronous SQL layer via asyncio.to_thread and maps exceptions to HTTP status codes |
backend/sql/ |
The actual queries. databricks_client.run_query is the only entry point to the SQL Warehouse |
backend/models/ |
Pydantic models. api.py is hand-written; per-table models are auto-generated |
backend/static/ |
Output of npm run build. Tracked and committed in git |
frontend/src/api/generated/ |
orval output. Never hand-edit it, nor openapi.yaml |
frontend/src/components/ |
Structured as <category>/<Name>/index.tsx + index.scss |
frontend/src/pages/ |
Route-backed pages, as <Name>/index.tsx + index.scss |
frontend/src/constants/ |
dwh.ts (catalog cs / schema cs_dm), navigation.ts (sidebar items) |
scripts/ |
Utilities for OpenAPI output and husky setup |
Where to Add New Files
- UI component โ
npm run generate:component(hygen createsfrontend/src/components/<category>/<Name>/) - Page โ create
frontend/src/pages/<Name>/index.tsx, add a Route inApp.tsx, and add a sidebar entry inconstants/navigation.ts - API endpoint โ add the query in
backend/sql/, the model inbackend/models/, and the router inbackend/routes/, then register it inroutersinbackend/routes/__init__.py. Regenerate types withnpm run generate:client - API client โ never hand-write it; use the output of
npm run generate:client
Do not forget to commit build output
What gets deployed is exactly what is in git, including backend/static/. After changing the frontend, the npm run build output must be committed or production will not reflect it.
A dead pre-commit hook
nodejs-fastapi-hello-world-app/.husky/pre-commit is unused. The hook that actually runs is .husky/pre-commit at the repository root; npm run prepare โ scripts/setup-husky.mjs switches husky's install target to the root.