This document outlines the target structure for the Evidence monorepo. The target structure has the following goals:
- Clear definition of what functionality should live where
- Good separation of concerns
- Environment and Framework agnosticity
- Ensure modularity to increase flexibility and encourage community contributions
- Evidence should dogfood all modularity to ensure a good DX for 3rd party developers
---
config:
theme: dark
---
%%{ init: { 'flowchart': { 'curve': 'monotoneX' } } }%%
graph LR
%% dependency-free (excluding logging)
usql("🦆 usql-duckdb")
echarts("📊 echarts")
icons("🎨 icons")
tailwind("🍃 tailwind")
%% library
lang-svelte("🧩 lang-svelte")
sdk("🛠️ sdk")
vite("📦 vite")
%% product
ui-svelte("🖼️ ui-svelte")
application-shell("📓 application-shell")
cli("⌨️ cli")
vscode("🆚 vscode")
subgraph core["🧠 Core Evidence Functionality"]
vite
usql
sdk
end
subgraph svelte-support["🎭 Svelte Language Support"]
lang-svelte
ui-svelte
end
subgraph ui-utilities["🎨 UI Utilities"]
tailwind
icons
echarts
end
subgraph sdk-client["🖥️ SDK User Interfaces"]
direction TB
cli
vscode
end
lang-svelte --> sdk
lang-svelte --> vite
linkStyle 0,1 stroke:coral,stroke-width:2px;
application-shell --> ui-svelte
application-shell --> lang-svelte
application-shell --> tailwind
application-shell --> icons
application-shell --> sdk
linkStyle 2,3,4,5,6 stroke:yellow,stroke-width:2px;
ui-svelte --> icons
ui-svelte --> tailwind
ui-svelte --> echarts
ui-svelte --> sdk
ui-svelte --> vite
linkStyle 7,8,9,10,11 stroke:red,stroke-width:2px;
sdk --> usql
linkStyle 12 stroke:cyan,stroke-width:2px;
sdk-client --> sdk
vite --> sdk
note["📝 Packages not shown:
logging, telemetry
(used by most packages)"]
cli ~~~ vscode
note ~~~ sdk-client
This is not a comprehensive list of all packages in the monorepo - it does not include any datasources. These will all exist in ./packages/datasources
, and do not have any bearing on the structure of the project
Provides the only open source driver for Universal SQL, using DuckDB WASM to deliver a fast query layer for NodeJS + Browser environments.
initDB
andsetParquetURLs
should be collapsed into a single function - right now if you don't set the parquet URLs then the database "fails" to initialize in an unclear way
This functionality was previously provided by @evidence-dev/universal-sql
- Provide standard functions for getting query columns and row counts
- Interact with DuckDB Native
- Cache to or from the filesystem
- Create
.parquet
files as part of the source evaluation process - Require being in a Vite project
Allows Evidence to collect anonymous information about product usage
- Provide a set, documented list of informations that are collected
- Provide a simple, clear way to opt out of telemetry
- Impact performance
- Record any PII or sensitive information
Responsible for providing a Vite plugin for converting a Vite app into an Evidence App
- Source HMR, Query File HMR, etc
- Caching, implicit API at
/_evidence
- Copy files from a Project to an Application Shell
Responsible for encapsulating all Evidence framework logic, contains the needed interfaces to create an Evidence App.
- Implement stores using Svelte's store contract (without referencing Svelte directly)
- Consider using a tool like nanostores
- Provides everything needed to turn a Vite project into an Evidence App
- This does not include framework-specific ergonomics such as those in @evidence-dev/lang-svelte
- Depend on Svelte, React, or any specific framework
- Utilities for reading and writing
evidence.config.yaml
according to a passed-in Zod Schema
- Library code used across environments
EvidenceError
,isDebug
,fillMissingData
,setTrackProxy
, etc.
- Library code to ease the creation of datasource plugins
- Previously
@evidence-dev/db-commons
- Utilities for loading Component Plugins
- Utilities for loading Datasource Plugins
- Utilities for evaluating Datasources
- Exposes functions for setting up the Application Shell and copying the Project into it
- Library code for interacting with USQL
Query
,Metric
, etc.
- Provide functions for error, warn, log, and debug
- Provide hooks to integrate logs into Evidence UIs (e.g. a log panel in VS Code)
- These hooks should have a standard interface for the contents of the logs
- Wrap / re-use an existing, tested logging framework to minimize first-party code
- e.g.
winston
orpino
should be used under the hood
- e.g.
Responsible for providing a smooth interface between the Evidence SDK and Svelte.
This functionality was previously provided by @evidence-dev/component-utilities
, @evidence-dev/preprocessor
and @evidence-dev/sdk/utils/svelte
- Provide a preprocessor to transform Evidence Markdown files to Svelte files
- Extracts & Bootstraps Queries
- Injects Component Plugins
- Initializes USQL
- Provide an interface to ease the use of sdk functionality in Svelte (e.g. using Svelte's context or lifecycle functions)
- Includes making SSR in an Application Shell (plugin) or Evidence App trivial
- Copy files from an Evidence Project to an Application Shell
Warning
This package would benefit from more definition and scoping.
It is not clear where the "boundary" is.
For example, will it infer the Y column of a chart if one is not provided?
Note
Some thought should be given to a similar pattern with mapping logic
Responsible for encapsulating Evidence's echarts configurations in a re-usable package. This package is extracted to enable Evidence charts to be rendered in NodeJS applications.
This functionality was previously provided by @evidence-dev/core-components
and @evidence-dev/component-utilities
- Abstract echarts interactions away from Svelte (e.g. makes
Chart.svelte
) - Apply echarts theme + styling (incl. user overrides)
- Depend on Svelte, React or any other framework
- Validate data (e.g. column existence)
- Summarize data
Responsible for providing Visualization and UI Components for building Evidence Apps
This functionality was previously provided by @evidence-dev/core-components
and @evidence-dev/component-utilities
- Provide the components needed to build a quality, comprehensive data application
- Provide the building blocks for Application shells
Responsible for supplementing existing icon libraries with Evidence-specific icons
- Provide icon sources using the steeze-ui format
- Support themeing
- Depend on Svelte, React or any other framework
Responsible for providing a consistent tailwind design language for all things Evidence
- Expose a tailwind preset
- Load and apply Evidence themes
Responsible for managing Evidence Projects and Datasources with an ergonomic, interactive TUI.
This functionality was previously provided by @evidence-dev/evidence
- Provides terminal-based wizards for SDK workflows
Responsible for enabling npm create evidence
- Wrap the cli
- Implement any functionality
Responsible for managing Evidence Projects and Datasources with a VS Code plugin.
This functionality was previously provided by evidence-vscode
- Provides wizards for SDK workflows in VS Code
- BI as Code tool using Markdown + SQL to build fast, reactive reports and apps
- Used by the Modern Data Professional
- An Application Shell built with the Evidence Framework
- Drop-in reactive data layer for any Vite-based application
- Used by front-end developers via sdk
- Uses the CLI or VS Code Extension to bootstrap, configure, develop, and deploy.
- Contains known directories (e.g.
pages
,sources
, etc.), and is copied into an Application Shell to create the final site. - Used to abstract away the complexity of modern web development to make it accessible for data professionals.
- The browser based rendering of an Evidence Project, either locally in development, or deployed online.
- The result of copying the content of an Evidence Project into an Application Shell Plugin.
- This will be a "final" project, that can be built into a deployable artifact.
- Application shells are hidden from the user (in the
.evidence
directory)
- An instance or configuration of a Datasource Plugin to create a discrete connection. Multiple datasources can use the same plugin within the same project.
- A collection of semantic tokens mapped to colors, images, and other customizations. Specified in
evidence.config.yaml
- A standalone Javascript package that contains components for Authors to use in their apps.
- The components specified in this package are implicitly loaded and do not need to be specified on each page.
- A standalone Javascript package that implements one of two interfaces for loading data from somewhere (databases, APIs, flat files, etc) and making it available in Evidence.
- Provides a shell application (in any framework) that creates a destination for the files in an Evidence Project.
- Includes an initial project state
- Creates plugins, components, or customizes an application shell (i.e. writing Javascript)
- Creates and maintains Evidence Projects without directly interfacing with the SDK
- Reads a completed, built Evidence App