
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
vite-plugin-botpress-actions
Advanced tools
Vite plugin for building Botpress-compatible actions from TypeScript
A Vite plugin that transforms modular TypeScript/JavaScript code into self-contained Botpress actions for deployment in Botpress Studio's Execute Card environment.
src/actions/.ts and .js filesnpm install --save-dev vite-plugin-botpress-actions
# or
pnpm add -D vite-plugin-botpress-actions
Add the plugin to your vite.config.js or vite.config.ts:
import { defineConfig } from 'vite';
import { botpressActionsPlugin } from 'vite-plugin-botpress-actions';
export default defineConfig({
plugins: [
botpressActionsPlugin({
// Optional configuration
actionsDir: 'src/actions', // default
schemasDir: 'src/schemas', // default
sharedDir: 'src/shared', // default
outputDir: 'dist', // default
extensions: ['ts', 'js'] // default
})
]
});
The plugin performs a three-pass build process:
dist/schemas/dist/actions/src/
├── actions/
│ ├── myAction.ts # Action implementations
│ └── anotherAction.js
├── schemas/
│ └── shared/ # Reusable schemas
│ └── common.ts
└── shared/ # Utility functions
└── helpers.ts
dist/
├── actions/
│ ├── myAction.ts # Function body only (paste into Execute Card)
│ └── anotherAction.js
└── schemas/
├── myActionInputSchema.ts # Action-specific schemas
└── shared/
└── common.ts # Shared schemas
Actions must follow this structure:
// src/actions/myAction.ts
import { z } from '@bpinternal/zui';
import { helperFunction } from '../shared/helpers.ts';
// Define schemas
const inputSchema = z.object({
name: z.string()
});
const outputSchema = z.object({
message: z.string()
});
// Export async function (name doesn't matter)
export async function myAction(input: z.infer<typeof inputSchema>) {
const result = helperFunction(input.name);
return { message: result };
}
| Option | Type | Default | Description |
|---|---|---|---|
actionsDir | string | 'src/actions' | Directory containing action files |
schemasDir | string | 'src/schemas' | Directory containing schema files |
sharedDir | string | 'src/shared' | Directory containing shared utilities |
outputDir | string | 'dist' | Output directory for built files |
extensions | string[] | ['ts', 'js'] | File extensions to process |
inlinePackages | object | { nanoid: '...' } | External packages to inline |
Actions run in a secure, sandboxed Deno environment with these pre-installed libraries:
axios - HTTP client_ (Lodash) - Utility libraryluxon - Date/time manipulationz/zui - Zod validation (@bpinternal/zui)client - Botpress Client (when enabled in bot settings)zai - Botpress AI utilities (@botpress/zai)Don't import these in your actions - they're globally available.
MIT
FAQs
Vite plugin for building Botpress-compatible actions from TypeScript
We found that vite-plugin-botpress-actions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.