Skip to main content
Evidence uses configuration files to customize build behavior, deployment settings, and data sources.

evidence.config.yaml

The main Evidence configuration file located in your project root.

Example

deployment:
  basePath: /my-app

components:
  evidenceInclude: true

Deployment Configuration

deployment.basePath
string
default:"/"
Base path for the application when deployed to a subdirectory. Used by SvelteKit’s paths.base configuration.

svelte.config.js

Optional custom SvelteKit configuration file in your project root.

Supported Customizations

You can extend Evidence’s default SvelteKit configuration:
/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: [
    // Add custom preprocessors
  ],
  kit: {
    // Customize SvelteKit options (except files)
  }
};

export default config;

Restrictions

The following configurations are disabled for Evidence projects and will be ignored:
  • extensions - File extensions are fixed to .svelte and .md
  • kit.files - File locations cannot be changed

Preprocessor Merging

Custom preprocessors are appended to Evidence’s default preprocessors:
  1. Evidence preprocessors (query extraction, etc.)
  2. Component injection
  3. PostCSS preprocessing
  4. Base path transformation
  5. Your custom preprocessors

Source Configuration

Data source configuration is stored in sources/[source-name]/connection.yaml.

Example: PostgreSQL Source

name: my_database
type: postgres
options:
  host: localhost
  database: mydb
  user: ${db_user}
  password: ${db_password}
  port: 5432

Variable Substitution

Use ${variable} syntax to reference environment variables:
host: ${db_host}
password: ${db_password}
Set variables:
EVIDENCE_VAR__db_host=localhost
EVIDENCE_VAR__db_password=secret
See Environment Variables for details.

Environment Variable Override

You can override any source option using environment variables:
EVIDENCE_SOURCE__my_database__host=production.db.com
EVIDENCE_SOURCE__my_database__password=prod_secret
Pattern: EVIDENCE_SOURCE__[source_name]__[option] See Environment Variables for details.

package.json Scripts

Recommended npm scripts for Evidence projects:
{
  "scripts": {
    "dev": "evidence dev",
    "build": "evidence build",
    "preview": "evidence preview",
    "sources": "evidence sources"
  }
}

Usage

npm run dev      # Start development server
npm run build    # Build for production
npm run preview  # Preview production build
npm run sources  # Generate data from sources

Build Configuration

The Evidence build system uses these internal configurations:

Adapter Configuration

Static adapter settings from svelte.config.js:
adapter: adapter({
  pages: process.env.EVIDENCE_BUILD_DIR ?? './build',
  strict: false
})
Override the output directory:
EVIDENCE_BUILD_DIR=./dist evidence build

File Locations (Fixed)

files: {
  routes: 'src/pages',
  lib: 'src/components'
}
These locations in .evidence/template/ cannot be customized.

Template Directory

Evidence uses .evidence/template/ as an internal build directory:
.evidence/template/
├── src/
│   ├── pages/        # Your pages/ directory synced here
│   └── components/   # Your components/ directory synced here
├── static/
│   └── data/         # Generated parquet files
├── sources/          # Your sources/ directory synced here
└── queries/          # Your queries/ directory synced here
This directory is managed automatically by Evidence CLI commands. Manual changes will be overwritten.

Build docs developers (and LLMs) love