[<-] Back

basesquare

Rust, axum, SQLite, Databricks · 2026 · 1 min read

A Databricks-to-SQLite sync engine and sidecar API server. Basesquare keeps a local SQLite copy of Unity Catalog tables for sub-millisecond reads, then propagates application writes back to Databricks via the SQL Statement REST API. HTTP sidecar (not a CLI library) — applications talk to it over REST. Embedded HTMX web console at /console.

Architecture

flowchart TB
    db[("Databricks<br/>Unity Catalog")]

    subgraph sidecar ["basesquare (axum sidecar)"]
        sync["Sync engine<br/>inbound: pull rows"]
        out["Outbound replay<br/>write_actions → Databricks"]
        sched["Scheduler<br/>per-table cron loops"]
        router["Query router<br/>local / remote /<br/>databricks_api / local_write"]
        console["Web console<br/>/console (HTMX)"]
    end

    subgraph storage ["~/.local/share/basesquare/"]
        org[("basesquare.db<br/>envs · projects · tables")]
        proj[("projects/*.db<br/>per-project data<br/>single-writer + read pool")]
    end

    app["Application"]

    app <-->|"REST"| router
    router <--> proj
    sched --> sync --> proj
    out -->|"OAuth client creds<br/>SQL Statement REST API"| db
    db --> sync
    org -.- sync

Workspace

Crate Purpose
basesquare-core Config, SQLite layer, Databricks REST client, sync engine, query executor, schema management, credential resolution
basesquare-api Axum HTTP server. Single binary basesquare. Routes, middleware, scheduler, shared state
basesquare-console Web UI (HTMX + minijinja). Embedded inside the API server at /console

Query routing

Reads can be answered four ways depending on the table config:

  • local — straight SQLite read (sub-ms)
  • remote — pass through to Databricks SQL
  • databricks_api — Databricks REST without going through SQL
  • local_write — local SQLite, with the write also queued for replay back to Databricks