IDE setup
On this page 6
Stacks source is TypeScript and STX. An editor only needs Bun-aware TypeScript support, HTML-style handling for .stx files, and the repository's generated declarations.
Generate project types
Run the generator after installing the project and whenever components, functions, models, or environment variables change:
buddy generate
buddy generate:types
Generated declarations live under storage/framework/types/. Keep that directory in the TypeScript project so browser and server auto-imports resolve correctly.
Visual Studio Code
Install the Stacks extension (Stacks.vscode-stacks). New projects already recommend it in .vscode/extensions.json. It is the only extension a Stacks project needs: it installs no others and depends on none.
- stx templates: highlighting, completions, hovers, diagnostics, go to definition and utility-class previews for
.stxfiles. This is the code of the standalone stx extension (Stacks.vscode-stx), built in. If you have both installed, the stx extension steps aside. - Pickier: lint diagnostics as you type, Format Document and a
source.fixAll.pickierfix-all, all from the project's own pickier andconfig/code-style.ts, so the editor agrees withbuddy lint. - Env files: hover an
encrypted:value to see it decrypted with the project's keys (it is never written anywhere), keys missing from.envcompared with.env.example, andbuddy env:get,env:set,env:encrypt,env:decryptandenv:rotatefrom the Command Palette. - Stacks: Start Dev Server runs
./buddy devin aStacks Devterminal. When the server is ready, the app opens in VS Code's built-in Simple Browser. - Stacks: Open Preview opens the running dev server in the Simple Browser, beside your editor. The Stacks item in the status bar does the same.
- Stacks: Run Buddy Command... lists every command from
./buddy list, your ownapp/Commands/included, and runs the one you pick. You can also type a command with its arguments, such asmigrate --diff.
The preview URL is worked out the same way buddy dev picks it: https://<APP_URL> when the local HTTPS proxy is up, otherwise http://localhost:<PORT>. Set stacks.preview.url to use a fixed URL instead, or stacks.preview.preferLocalhost if the Simple Browser cannot load the local certificate. The extension README lists every setting.
buddy setup copies the workspace settings from storage/framework/defaults/ide/vscode/.vscode/ into new projects. The important ones are:
{
"editor.defaultFormatter": "Stacks.vscode-stacks",
"editor.codeActionsOnSave": {
"source.fixAll.pickier": "explicit"
},
"files.associations": {
"buddy": "shellscript"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
Do not map *.stx to html in VS Code. A files.associations entry wins over the stx language the extension registers, so .stx files would lose its features.
Use the workspace TypeScript version so the editor and buddy test:types evaluate the same compiler configuration.
These are optional, but they work well alongside it:
- EditorConfig
- Error Lens
- GitLens
STX template behavior comes from @stacksjs/stx, its generated types, and the Bun plugin configured by the project.
Zed and JetBrains
Associate *.stx with HTML for syntax highlighting and keep TypeScript language services enabled for script blocks. Use the repository's .zed/ or .idea/ defaults when present, then run buddy generate:types so inferred APIs are available.
Formatting and diagnostics
Buddy delegates linting and formatting to Pickier:
buddy lint
buddy lint --fix
buddy format:check
buddy test:types
Do not configure ESLint or Prettier as a competing formatter. Project rules live in config/code-style.ts and .config/pickier.ts where present.
STX conventions
- Put views in
resources/views/and components inresources/components/. - Use ts-css utility classes.
- Use signals and composables in
<script>blocks. - Do not use direct
windowordocumentaccess in templates. - Import standalone APIs from
@stacksjs/stx; template auto-imports do not need explicit imports.
Troubleshooting
If completion or types are stale:
buddy generate:types
buddy doctor
buddy test:types
Restart the editor's TypeScript language server after regeneration if it still holds an old declaration graph.