SDK Reference
Configuration
Configure Midstream for your project
Configuration
Midstream uses a midstream.json file in your project root to configure how demos are built and run.
Basic Configuration
{
"install": "npm install",
"start": "npm start",
"test": "npx playwright test {{file}} -g {{grep}}"
}
Configuration Options
install
Command to install dependencies. Runs once when the demo environment starts.
{
"install": "pnpm install --frozen-lockfile"
}
start
Command to start your application. Should start a development server.
{
"start": "npm run dev"
}
test
Command template to run tests. Use placeholders for dynamic values:
{{file}}- The test file path{{grep}}- The test name pattern
{
"test": "npx playwright test {{file}} -g {{grep}}"
}
Environment Variables
Midstream automatically provides certain environment variables:
| Variable | Description |
|---|---|
MIDSTREAM_RUNNER | Set to true in demo environment |
MIDSTREAM_CHECKPOINT | The checkpoint being demonstrated |
Example Configurations
Next.js Project
{
"install": "npm install",
"start": "npm run dev",
"test": "npx playwright test {{file}} -g {{grep}}"
}
Vite Project
{
"install": "pnpm install",
"start": "pnpm dev",
"test": "pnpm playwright test {{file}} -g {{grep}}"
}
Monorepo
{
"install": "pnpm install",
"start": "pnpm --filter @myapp/web dev",
"test": "pnpm --filter @myapp/e2e test {{file}} -g {{grep}}"
}