Overview
Superset allows you to automate workspace initialization and cleanup through configuration files. The.superset/config.json file in your repository root defines scripts that run when workspaces are created or deleted.
Configuration is per-repository. Each project can have its own setup and teardown logic.
.superset/config.json Format
The configuration file uses a simple JSON structure:Scripts are executed in order. If a script fails, subsequent scripts still run.
Setup Scripts
Setup scripts run automatically when a workspace is created, before any presets execute.When Setup Scripts Run
- User creates a workspace (
⌘Nor⌘⇧N) - Superset creates git worktree
- Setup scripts execute ← You are here
- Terminal session starts
- Presets execute (if configured)
Example Setup Script
Here’s a typical setup script that prepares a workspace:Common Setup Tasks
Copy .env Files
.env, so copy it from the main repo.Install Dependencies
node_modules.Database Migrations
Build Assets
Teardown Scripts
Teardown scripts run when a workspace is deleted, before the git worktree is removed.When Teardown Scripts Run
- User deletes workspace
- Superset closes terminal sessions
- Teardown scripts execute ← You are here
- Git worktree is removed
- Workspace metadata cleaned up
Example Teardown Script
Common Teardown Tasks
Stop Services
Clean Temp Files
Archive Data
Cleanup Docker
Environment Variables in Scripts
Scripts run with special environment variables provided by Superset:Using Environment Variables
Real Configuration Examples
Example 1: Node.js Project
Example 2: Python Project with Database
Example 3: Docker Compose Project
Example 4: Monorepo with Selective Install
Example 5: Multi-Stage Setup
Script Best Practices
Use set -euo pipefail
Start scripts with:Exits on error, unset variables, and pipe failures.
Provide Feedback
Handle Failures Gracefully
Make Scripts Idempotent
Error Handling
Handle errors gracefully to prevent setup failures:Performance Optimization
Debugging Scripts
If setup or teardown scripts fail:1. Check Script Output
Superset shows script output in the workspace creation dialog. Look for error messages.2. Run Scripts Manually
Test scripts in a terminal:3. Add Debug Output
4. Check Permissions
Configuration Validation
Superset validates.superset/config.json when loading a project:
- ✅ Valid JSON syntax
- ✅
setupandteardownare arrays of strings - ✅ Script paths are relative (not absolute)
- ⚠️ Warning if script files don’t exist
- ⚠️ Warning if scripts aren’t executable
Relationship with Presets
Setup scripts run before presets:Security Considerations
Safe Practices
- Review scripts before running: Check
.superset/contents in new projects - Limit scope: Only modify files within the workspace
- Avoid sudo: Setup scripts shouldn’t require elevated permissions
- Validate inputs: Don’t trust environment variables blindly
Advanced Use Cases
Conditional Logic Based on Branch
Port Allocation
Caching Dependencies
Next Steps
Presets
Configure workspace presets that run after setup
Workspaces
Learn more about workspace creation
Quickstart
Create your first workspace with setup scripts
Worktrees
Understand git worktree mechanics