Deployment Overview

In production, Evidence generates static sites by default. This means it doesn't run queries against your database when someone visits your site, but queries and pre-builds all pages as HTML beforehand.

Static sites are very versatile, and so you can host your Evidence app using Evidence Cloud, cloud services like AWS, Azure, Netlify or Vercel, or your own infrastructure.

You can also configure Evidence as a Single Page App (SPA). In SPA mode Evidence will not pre-build all the pages in your application. This can be preferrable if your app has many pages (>1,000) causing long build times.

Evidence Cloud

The easiest way to deploy Evidence is on Evidence Cloud. Evidence Cloud is free for public apps, and has paid plans for private apps.

Self-host

You can also self-host Evidence anywhere suitable for hosting static sites. See guides for:

Build Process

Evidence doesn't run new queries each time someone visits one of your reports.

Instead, Evidence runs your queries once, at build time, and statically generates all of the pages in your app. This includes all possible permutations of any paramaterized pages.

You can schedule (or trigger) regular builds of your site to keep it up-to-date with your data warehouse.

This has two benefits for you and your users:

  1. If something goes wrong with your SQL, Evidence just stops building your app, and continues to serve older results.
  2. Your site will be exceptionally fast. Under most conditions, pages will load in milliseconds.

Build Commands

Build

The command npm run build will build a static version of your reports and place them in the build directory.

Build:Strict

The command npm run build:strict is a much less permissive build command. Use this to ensure you never deploy a broken report. This command will fail if:

  • Any SQL query fails. A successful query returning no rows is not a failure
  • Any component renders an error state. A component passed a valid query returning no rows will fail - you can avoid this with an {#if} statement if needed.

Storing Credentials

In production, Evidence expects to find your database credentials in environment variables.

To find the environment variables that you'll need to set for your app:

  1. Run your app in development mode
  2. Visit the settings page
  3. Open the deployment panel, and select your deployment target