Overview
Ladybugs helps you debug production issues by capturing complete runtime context. This guide will walk you through setting up Ladybugs for your JavaScript/TypeScript project.Quick Start
1
Start the Docker container
Run the Ladybugs collection server on port 4866:
2
Build/run your project with Ladybugs CLI
Use the
@ladybugs/cli tool to instrument and run your project (see options below).3
Reproduce the bug
Interact with your application to trigger the bug you want to debug.
4
Debug with AI + MCP
Use the MCP integration through your favorite AI tool to automatically investigate and fix the bug.
5
Clean up
Remove the Docker container to free up space:
Currently, collected data is not cleaned automatically, so remember to remove the container when done.
Using the CLI Tool
The@ladybugs/cli tool automatically instruments your code with the Babel plugin and handles the build process.
Backend Projects & Standalone Scripts
For Node.js applications or standalone JavaScript/TypeScript files:--import-type=import- For ES modules (import/export)--import-type=require- For CommonJS (require/module.exports)
Frontend Projects
For frontend applications (currently supports vanilla JS and Vite + React):The CLI automatically detects your frontend framework and handles the instrumentation.
Build-Only Mode
If you want to build without immediately running:Advanced Usage
Manual Babel Configuration
For more control, you can manually integrate the@ladybugs/babel-plugin-debug into your existing build configuration.
- Babel Config
- Vite Config
Add the plugin to your
babel.config.js or .babelrc:Include the SDK
When using manual configuration, you must include the Ladybugs SDK in your HTML:Environment Variables
For client-side production builds, you may need to set:Important Limitations
Production builds only
Ladybugs requires a full production build. It won’t work reliably with:
- Watch mode (
--watch) - Development servers (
devmode) - Hot module replacement (HMR)
Supported frameworks
Currently supported:
- Node.js (any version)
- Vanilla JavaScript
- Vite + React
Troubleshooting
Docker container won’t start
Make sure port 4866 is not already in use:CLI tool errors
Module import errors
Module import errors
Always use
--import-type flag to specify your module system:- Use
--import-type=importfor ES modules - Use
--import-type=requirefor CommonJS
TypeScript compilation errors
TypeScript compilation errors
Ensure the Ladybugs Babel plugin is added after TypeScript parsing plugins in your Babel config.
Build succeeds but no data collected
Build succeeds but no data collected
- Verify the Docker container is running:
docker ps - Check that your app can reach
http://localhost:4866 - For frontend builds, ensure the SDK script is included in your HTML
- For client builds, try setting
ENV_TYPE=browser
Can’t connect to collection server
If your application can’t send data to the Docker container:- Verify the container is running:
docker ps | grep ladybugsio/collection-server - Check Docker logs:
docker logs $(docker ps -q --filter ancestor=ladybugsio/collection-server:latest) - Ensure no firewall is blocking port 4866
- Contact Ladybugs support at [email protected]