<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Building Interactive Web Applications with Databricks Connect in Technical Blog</title>
    <link>https://community.databricks.com/t5/technical-blog/building-interactive-web-applications-with-databricks-connect/ba-p/120724</link>
    <description>&lt;P&gt;&lt;SPAN&gt;As organizations become more data-driven, there’s growing pressure to bring powerful data and AI capabilities directly to the people making business decisions. This means enabling non-technical users to interact with curated data, run complex logic, and trigger workflows through intuitive, purpose-built applications.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Common examples include:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Audit and compliance workflows&lt;/STRONG&gt;&lt;SPAN&gt; that let users review large-scale transactional data, apply business rules, and manage mapping tables (e.g., account classifications, thresholds). Editable dimensions, approvals, and audit trails ensure regulatory compliance and integrity.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Scenario modeling for credit and market risk&lt;/STRONG&gt;&lt;SPAN&gt; that enables teams to tweak assumptions and compare outputs across massive datasets, supporting what-if analysis without needing to write SQL or touch raw data.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Document intake and GenAI processing pipelines&lt;/STRONG&gt;&lt;SPAN&gt; that process user-submitted documents in real time, apply validation rules, extract structured data, and trigger LLM-based summarization or redaction—all while maintaining audit trails.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Traditional BI tools fall short in these cases. They don’t allow users to modify dimension tables, launch jobs, or coordinate multi-user workflows. What’s needed is a scalable, flexible application framework that integrates deeply with the Databricks Lakehouse, which offers the performance, governance, and openness required for enterprise-grade solutions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this post, we’ll walk through a modern 3-tier architecture built on:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;React for a responsive, user-friendly frontend&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;A &lt;/SPAN&gt;&lt;A href="https://fastapi.tiangolo.com/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;FastAPI&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; backend as an asynchronous intermediary for handling business logic and APIs&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The Databricks platform with secure, scalable data processing and workflow management, and built-in intelligence for governance, observability, and automation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anupkalburgi_1-1748874898128.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17278iBE9B944A524EF211/image-size/medium?v=v2&amp;amp;px=400" role="button" title="anupkalburgi_1-1748874898128.png" alt="anupkalburgi_1-1748874898128.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We’ll explore how these components work together to deliver secure, interactive, and scalable data applications, bringing the full power of Databricks to business users who drive real outcomes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Why 3-Tier Architecture?&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;This 3-tier architecture cleanly separates responsibilities across the frontend, backend, and data platform—enabling each layer to scale independently, be maintained in isolation, and contribute to a more secure, performant, and cost-efficient solution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;Factor&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;React&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;FastAPI&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;Databricks&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Separation of Concerns&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Handles user input, triggers jobs, and displays results through interactive UIs&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Acts as the API layer: validates requests, translates them into Spark/SQL via Databricks Connect, formats responses, and manages integrations&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Executes complex workflows and data transformations with low management overhead&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Tech&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;React with component-based design; state management via useState, useContext, Redux, etc.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;FastAPI—async-ready with Pydantic validation and auto-generated OpenAPI docs&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks Serverless, Delta Lake, Unity Catalog, and Databricks Connect for secure communication with the backend&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Scalability&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Static frontend assets served via CDN&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Scales horizontally with load&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Auto-scales compute up or down (even to zero) based on workload demand; ideal for bursty or interactive workloads&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Enhanced Security &amp;amp; Governance&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Minimal exposure; no direct access to data&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks tokens represent user identity; acts as a secure intermediary&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Unity Catalog enforces fine-grained access control and governs data usage via Databricks Connect&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Maintainability &amp;amp; Flexibility&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;UI updates isolated from backend and compute layers&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Modular endpoints; decouples frontend from data logic&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Logic is centralized at the data layer using PySpark or SQL; easily reused across workflows&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Cost Efficiency&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Low hosting cost for static files&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Lightweight server footprint, low infra overhead&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Pay-per-use Serverless compute &lt;/SPAN&gt;&lt;STRONG&gt;scales to zero&lt;/STRONG&gt;&lt;SPAN&gt;, eliminating the need for persistent clusters and ensuring charges only for execution time&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;H3&gt;&lt;SPAN&gt;Sample Application and Component Walkthrough&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;An example application that demonstrates all the components described above is provided in this GitHub project:&lt;/SPAN&gt; &lt;A href="https://github.com/anupkalburgi/db-connect-webapp" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;db-connect-webapp&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This simple application provides a &lt;/SPAN&gt;&lt;A href="http://react.js" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;React.js&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; WebUI interface that allows a user to pick a Delta table in a Databricks Unity Catalog schema (“database”) and interactively query and filter results from it.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This example demonstrates the concepts of:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;A front-end application connecting to the FastAPI service using API calls (frontend/app/lib/api.ts)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Custom application logic is coded in the FastAPI service (backend/app/main.py)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The FastAPI service uses Databricks Connect to authenticate to the Databricks data platform by importing backend/app/DataSource.py&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Data platform services provided by the FastAPI application are covered by Unit Tests in backend/app/tests. These unit tests cover the specifics of the transformation logic and data operations of the application.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;H3&gt;&lt;SPAN&gt;Running the example application&lt;/SPAN&gt;&lt;/H3&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Backend Prerequisites&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Access to a Databricks workspace is required. Authentication via an &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;M2M Service Principal&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; or user PAT token must be available.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;The pre-installed Databricks &lt;/SPAN&gt;&lt;SPAN&gt;samples.nyctaxi &lt;/SPAN&gt;&lt;SPAN&gt;catalog schema can be used for testing, or grant access to the above Service Principal for a different data-set.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Start the Backend services.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Check the Backend Configure and Run section in the main README file. It provides instructions on setting up environment variables that specify the Databricks authentication details.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Use the backend/run.sh script to start the FastAPI service with a backend connection to Databricks&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Frontend Prerequisites&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Check the Frontend Configure and Run section in the main README.md file.&amp;nbsp; This provides instructions on installing the web server dependencies (npm or yarn)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Follow the &lt;/SPAN&gt;&lt;A href="http://readme.md" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;README.md&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; instructions for setting environment variables to specify the Backend API service URL and the Databricks data Catalog and Schema (eg. samples, nyctaxi)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Start the Frontend services.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Use the frontend/run.sh script to start the Node.js web services.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;The default configuration starts a web-server process listening to the local host address on port 3000 (&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://localhost:3000" target="_blank" rel="noopener"&gt;http://localhost:3000&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anupkalburgi_2-1748875012351.png" style="width: 801px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17279iB69810502D9D10B3/image-dimensions/801x509?v=v2" width="801" height="509" role="button" title="anupkalburgi_2-1748875012351.png" alt="anupkalburgi_2-1748875012351.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Extending the application&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;The concepts of the example web application can be extended by introducing a customizable middle API tier. This architectural choice offers significant flexibility beyond a simple web query interface. Within this API layer, leveraging the Databricks data platform interface via the Spark DataFrame API is key. This empowers developers to easily implement complex data transformations, dynamic business logic, and robust unit testing. Furthermore, it directly unlocks more sophisticated operations, such as invoking registered machine learning models and integrating with Large Language Models (LLMs&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Advantages of Spark DataFrame API with Databricks Connect in UI-Driven Applications&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;When building interactive UI-driven data applications, leveraging the Spark DataFrame API via Databricks Connect provides distinct advantages over traditional SQL interfaces, especially for complex logic, dynamic transformations, and robust testability.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;SPAN&gt;Dynamic Transformations Based on User Inputs&lt;/SPAN&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;In user-centric applications, backend queries often need to adapt dynamically to user-selected filters, columns, or metrics. Consider a scenario where new columns need to be dynamically added based on specific user selections, such as flagging certain data elements. The DataFrame API handles these cases gracefully:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Dynamically add columns based on user input
for col in selected_columns:
    df = df.withColumn(f"{col}_flag", df[col] &amp;gt; 0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Such dynamic manipulations are cumbersome to implement and maintain with traditional SQL queries.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Expressing Complex Business Logic Clearly&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;Many business rules involve conditional logic, window functions, or complex joins. DataFrame API simplifies these implementations significantly:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from pyspark.sql.functions import when, col
df = df.withColumn("category", when(col("score") &amp;gt; 90, "Gold").otherwise("Standard"))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Equivalent SQL queries often become nested and challenging to debug or understand clearly, reducing maintainability.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;SPAN&gt;Enhanced Testability and Validation&lt;/SPAN&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;Writing DataFrame transformations as modules allows for robust unit testing of logic through PySpark testing suites and local Spark sessions:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;def add_category_column(df):
    return df.withColumn("category", when(df["score"] &amp;gt; 90, "Gold").otherwise("Standard"))
# Unit test with a small DataFrame
test_df = spark.createDataFrame([(1, 95), (2, 70)], ["id", "score"])
result_df = add_category_column(test_df)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;SQL-based transformations, by contrast, typically require extensive integration testing with full execution contexts, complicating validation and compliance certification.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Deployment Options&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Follow your organization's established deployment practices and infrastructure guidelines when deploying applications. For quick deployment and end-to-end testing, deploy the application to Databricks Apps using the steps below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;
&lt;H5&gt;&lt;SPAN&gt;To prepare and deploy, run databricks_app_build.sh in the root folder. This script performs the following actions&lt;/SPAN&gt;&lt;/H5&gt;
&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Build frontend assets and organize the deployment directory with all necessary components.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Deploy the application to Databricks Apps&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Set environment variables required for the application&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Start the application using Uvicorn with four worker processes&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;For a comprehensive understanding of Databricks Apps and their capabilities, including features, benefits, and integration with the Lakehouse Architecture, refer to the&lt;/SPAN&gt;&lt;A href="https://www.databricks.com/blog/introducing-databricks-apps" target="_blank" rel="noopener"&gt;&lt;SPAN&gt; official Databricks blog post on Databricks Apps&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Conclusion&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Combining a dynamic React frontend, an efficient FastAPI backend, and the power of Databricks Serverless Compute via Databricks Connect creates a modern, scalable, and cost-effective architecture for interactive data applications. This 3-tier setup provides excellent separation of concerns, robust security, and leverages the auto-scaling, pay-per-use benefits of Serverless compute, reducing management overhead significantly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Check out the code repository &lt;A href="https://github.com/databricks-solutions/databricks-blogposts/tree/main/2025-04-interactive-apps-with-databricks" target="_self"&gt;here&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, experiment, and see how this architecture can accelerate your data application development!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;References&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Introduction to Databricks Connect - &lt;/SPAN&gt;&lt;A href="https://www.databricks.com/blog/2019/06/14/databricks-connect-bringing-the-capabilities-of-hosted-apache-spark-to-applications-and-microservices.html" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://www.databricks.com/blog/2019/06/14/databricks-connect-bringing-the-capabilities-of-hosted-apache-spark-to-applications-and-microservices.html&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Databricks Connect - &lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-connect/" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/dev-tools/databricks-connect/&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;Databricks Apps - &lt;A style="font-family: inherit; background-color: #ffffff;" href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/dev-tools/databricks-apps&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Tue, 10 Jun 2025 15:55:04 GMT</pubDate>
    <dc:creator>anupkalburgi</dc:creator>
    <dc:date>2025-06-10T15:55:04Z</dc:date>
    <item>
      <title>Building Interactive Web Applications with Databricks Connect</title>
      <link>https://community.databricks.com/t5/technical-blog/building-interactive-web-applications-with-databricks-connect/ba-p/120724</link>
      <description>&lt;P&gt;&lt;SPAN&gt;As organizations become more data-driven, there’s growing pressure to bring powerful data and AI capabilities directly to the people making business decisions. This means enabling non-technical users to interact with curated data, run complex logic, and trigger workflows through intuitive, purpose-built applications.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Common examples include:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Audit and compliance workflows&lt;/STRONG&gt;&lt;SPAN&gt; that let users review large-scale transactional data, apply business rules, and manage mapping tables (e.g., account classifications, thresholds). Editable dimensions, approvals, and audit trails ensure regulatory compliance and integrity.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Scenario modeling for credit and market risk&lt;/STRONG&gt;&lt;SPAN&gt; that enables teams to tweak assumptions and compare outputs across massive datasets, supporting what-if analysis without needing to write SQL or touch raw data.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Document intake and GenAI processing pipelines&lt;/STRONG&gt;&lt;SPAN&gt; that process user-submitted documents in real time, apply validation rules, extract structured data, and trigger LLM-based summarization or redaction—all while maintaining audit trails.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Traditional BI tools fall short in these cases. They don’t allow users to modify dimension tables, launch jobs, or coordinate multi-user workflows. What’s needed is a scalable, flexible application framework that integrates deeply with the Databricks Lakehouse, which offers the performance, governance, and openness required for enterprise-grade solutions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this post, we’ll walk through a modern 3-tier architecture built on:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;React for a responsive, user-friendly frontend&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;A &lt;/SPAN&gt;&lt;A href="https://fastapi.tiangolo.com/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;FastAPI&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; backend as an asynchronous intermediary for handling business logic and APIs&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The Databricks platform with secure, scalable data processing and workflow management, and built-in intelligence for governance, observability, and automation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anupkalburgi_1-1748874898128.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17278iBE9B944A524EF211/image-size/medium?v=v2&amp;amp;px=400" role="button" title="anupkalburgi_1-1748874898128.png" alt="anupkalburgi_1-1748874898128.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We’ll explore how these components work together to deliver secure, interactive, and scalable data applications, bringing the full power of Databricks to business users who drive real outcomes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Why 3-Tier Architecture?&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;This 3-tier architecture cleanly separates responsibilities across the frontend, backend, and data platform—enabling each layer to scale independently, be maintained in isolation, and contribute to a more secure, performant, and cost-efficient solution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;Factor&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;React&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;FastAPI&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="50px"&gt;
&lt;P&gt;&lt;STRONG&gt;Databricks&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Separation of Concerns&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Handles user input, triggers jobs, and displays results through interactive UIs&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Acts as the API layer: validates requests, translates them into Spark/SQL via Databricks Connect, formats responses, and manages integrations&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Executes complex workflows and data transformations with low management overhead&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Tech&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;React with component-based design; state management via useState, useContext, Redux, etc.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;FastAPI—async-ready with Pydantic validation and auto-generated OpenAPI docs&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks Serverless, Delta Lake, Unity Catalog, and Databricks Connect for secure communication with the backend&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Scalability&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Static frontend assets served via CDN&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Scales horizontally with load&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Auto-scales compute up or down (even to zero) based on workload demand; ideal for bursty or interactive workloads&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Enhanced Security &amp;amp; Governance&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Minimal exposure; no direct access to data&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks tokens represent user identity; acts as a secure intermediary&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="132px"&gt;
&lt;P&gt;&lt;SPAN&gt;Unity Catalog enforces fine-grained access control and governs data usage via Databricks Connect&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Maintainability &amp;amp; Flexibility&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;UI updates isolated from backend and compute layers&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Modular endpoints; decouples frontend from data logic&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="105px"&gt;
&lt;P&gt;&lt;SPAN&gt;Logic is centralized at the data layer using PySpark or SQL; easily reused across workflows&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="133.688px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Cost Efficiency&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="193.325px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Low hosting cost for static files&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="242.113px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Lightweight server footprint, low infra overhead&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="254.875px" height="159px"&gt;
&lt;P&gt;&lt;SPAN&gt;Pay-per-use Serverless compute &lt;/SPAN&gt;&lt;STRONG&gt;scales to zero&lt;/STRONG&gt;&lt;SPAN&gt;, eliminating the need for persistent clusters and ensuring charges only for execution time&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;H3&gt;&lt;SPAN&gt;Sample Application and Component Walkthrough&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;An example application that demonstrates all the components described above is provided in this GitHub project:&lt;/SPAN&gt; &lt;A href="https://github.com/anupkalburgi/db-connect-webapp" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;db-connect-webapp&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This simple application provides a &lt;/SPAN&gt;&lt;A href="http://react.js" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;React.js&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; WebUI interface that allows a user to pick a Delta table in a Databricks Unity Catalog schema (“database”) and interactively query and filter results from it.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This example demonstrates the concepts of:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;A front-end application connecting to the FastAPI service using API calls (frontend/app/lib/api.ts)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Custom application logic is coded in the FastAPI service (backend/app/main.py)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The FastAPI service uses Databricks Connect to authenticate to the Databricks data platform by importing backend/app/DataSource.py&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Data platform services provided by the FastAPI application are covered by Unit Tests in backend/app/tests. These unit tests cover the specifics of the transformation logic and data operations of the application.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;H3&gt;&lt;SPAN&gt;Running the example application&lt;/SPAN&gt;&lt;/H3&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Backend Prerequisites&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Access to a Databricks workspace is required. Authentication via an &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;M2M Service Principal&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; or user PAT token must be available.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;The pre-installed Databricks &lt;/SPAN&gt;&lt;SPAN&gt;samples.nyctaxi &lt;/SPAN&gt;&lt;SPAN&gt;catalog schema can be used for testing, or grant access to the above Service Principal for a different data-set.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Start the Backend services.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Check the Backend Configure and Run section in the main README file. It provides instructions on setting up environment variables that specify the Databricks authentication details.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Use the backend/run.sh script to start the FastAPI service with a backend connection to Databricks&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Frontend Prerequisites&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Check the Frontend Configure and Run section in the main README.md file.&amp;nbsp; This provides instructions on installing the web server dependencies (npm or yarn)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Follow the &lt;/SPAN&gt;&lt;A href="http://readme.md" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;README.md&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; instructions for setting environment variables to specify the Backend API service URL and the Databricks data Catalog and Schema (eg. samples, nyctaxi)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Start the Frontend services.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Use the frontend/run.sh script to start the Node.js web services.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;The default configuration starts a web-server process listening to the local host address on port 3000 (&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="http://localhost:3000" target="_blank" rel="noopener"&gt;http://localhost:3000&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anupkalburgi_2-1748875012351.png" style="width: 801px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17279iB69810502D9D10B3/image-dimensions/801x509?v=v2" width="801" height="509" role="button" title="anupkalburgi_2-1748875012351.png" alt="anupkalburgi_2-1748875012351.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Extending the application&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;The concepts of the example web application can be extended by introducing a customizable middle API tier. This architectural choice offers significant flexibility beyond a simple web query interface. Within this API layer, leveraging the Databricks data platform interface via the Spark DataFrame API is key. This empowers developers to easily implement complex data transformations, dynamic business logic, and robust unit testing. Furthermore, it directly unlocks more sophisticated operations, such as invoking registered machine learning models and integrating with Large Language Models (LLMs&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Advantages of Spark DataFrame API with Databricks Connect in UI-Driven Applications&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;When building interactive UI-driven data applications, leveraging the Spark DataFrame API via Databricks Connect provides distinct advantages over traditional SQL interfaces, especially for complex logic, dynamic transformations, and robust testability.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;SPAN&gt;Dynamic Transformations Based on User Inputs&lt;/SPAN&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;In user-centric applications, backend queries often need to adapt dynamically to user-selected filters, columns, or metrics. Consider a scenario where new columns need to be dynamically added based on specific user selections, such as flagging certain data elements. The DataFrame API handles these cases gracefully:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Dynamically add columns based on user input
for col in selected_columns:
    df = df.withColumn(f"{col}_flag", df[col] &amp;gt; 0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Such dynamic manipulations are cumbersome to implement and maintain with traditional SQL queries.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Expressing Complex Business Logic Clearly&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;Many business rules involve conditional logic, window functions, or complex joins. DataFrame API simplifies these implementations significantly:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from pyspark.sql.functions import when, col
df = df.withColumn("category", when(col("score") &amp;gt; 90, "Gold").otherwise("Standard"))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Equivalent SQL queries often become nested and challenging to debug or understand clearly, reducing maintainability.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;SPAN&gt;Enhanced Testability and Validation&lt;/SPAN&gt;&lt;/H4&gt;
&lt;P&gt;&lt;SPAN&gt;Writing DataFrame transformations as modules allows for robust unit testing of logic through PySpark testing suites and local Spark sessions:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;def add_category_column(df):
    return df.withColumn("category", when(df["score"] &amp;gt; 90, "Gold").otherwise("Standard"))
# Unit test with a small DataFrame
test_df = spark.createDataFrame([(1, 95), (2, 70)], ["id", "score"])
result_df = add_category_column(test_df)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;SQL-based transformations, by contrast, typically require extensive integration testing with full execution contexts, complicating validation and compliance certification.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Deployment Options&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Follow your organization's established deployment practices and infrastructure guidelines when deploying applications. For quick deployment and end-to-end testing, deploy the application to Databricks Apps using the steps below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;
&lt;H5&gt;&lt;SPAN&gt;To prepare and deploy, run databricks_app_build.sh in the root folder. This script performs the following actions&lt;/SPAN&gt;&lt;/H5&gt;
&lt;/LI&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Build frontend assets and organize the deployment directory with all necessary components.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Deploy the application to Databricks Apps&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Set environment variables required for the application&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="2"&gt;&lt;SPAN&gt;Start the application using Uvicorn with four worker processes&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;For a comprehensive understanding of Databricks Apps and their capabilities, including features, benefits, and integration with the Lakehouse Architecture, refer to the&lt;/SPAN&gt;&lt;A href="https://www.databricks.com/blog/introducing-databricks-apps" target="_blank" rel="noopener"&gt;&lt;SPAN&gt; official Databricks blog post on Databricks Apps&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Conclusion&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Combining a dynamic React frontend, an efficient FastAPI backend, and the power of Databricks Serverless Compute via Databricks Connect creates a modern, scalable, and cost-effective architecture for interactive data applications. This 3-tier setup provides excellent separation of concerns, robust security, and leverages the auto-scaling, pay-per-use benefits of Serverless compute, reducing management overhead significantly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Check out the code repository &lt;A href="https://github.com/databricks-solutions/databricks-blogposts/tree/main/2025-04-interactive-apps-with-databricks" target="_self"&gt;here&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, experiment, and see how this architecture can accelerate your data application development!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;References&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Introduction to Databricks Connect - &lt;/SPAN&gt;&lt;A href="https://www.databricks.com/blog/2019/06/14/databricks-connect-bringing-the-capabilities-of-hosted-apache-spark-to-applications-and-microservices.html" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://www.databricks.com/blog/2019/06/14/databricks-connect-bringing-the-capabilities-of-hosted-apache-spark-to-applications-and-microservices.html&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Databricks Connect - &lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-connect/" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/dev-tools/databricks-connect/&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;Databricks Apps - &lt;A style="font-family: inherit; background-color: #ffffff;" href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/dev-tools/databricks-apps&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 10 Jun 2025 15:55:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/building-interactive-web-applications-with-databricks-connect/ba-p/120724</guid>
      <dc:creator>anupkalburgi</dc:creator>
      <dc:date>2025-06-10T15:55:04Z</dc:date>
    </item>
  </channel>
</rss>

