Skip to content

DevCommand

Reference doc for the `sst.experimental.DevCommand` component.

The DevCommand lets you run a command in a separate pane when you run sst dev.

The sst dev CLI starts a multiplexer with panes for separate processes. This component allows you to add a process to it.

This component only works in sst dev. It does not do anything in sst deploy.

Example

For example, you can use this to run Drizzle Studio locally.

sst.config.ts
new sst.x.DevCommand("Studio", {
link: [rds],
dev: {
autostart: true,
command: "npx drizzle-kit studio",
},
});

Here npx drizzle-kit studio will be run in sst dev and will show up under the Studio tab. It’ll also have access to the links from rds.


Constructor

new DevCommand(name, args, opts?)

Parameters

DevCommandArgs

dev?

dev.autostart?

Type Input<boolean>

Default true

Configure if you want to automatically start this when sst dev starts. You can still start it manually later.

dev.command?

Type Input<string>

Default “npm run dev”

The command that sst dev runs to start this in dev mode.

dev.directory?

Type Input<string>

Default The project root.

Change the directory from where the command is run.

dev.title?

Type Input<string>

Default The name of the component.

The title of the tab in the multiplexer.

environment?

Type Input<Record<string, Input<string>>>

Set environment variables for this command.

{
environment: {
API_URL: api.url,
STRIPE_PUBLISHABLE_KEY: "pk_test_123"
}
}

Type Input<any[]>

Link resources to your command. This will allow you to access it in your command using the SDK.

Takes a list of resources to link.

{
link: [bucket, stripeKey]
}