@pepperi-addons/debug-server
v1.1.2
Published
A server to run a pepperi addon locally
Readme
@pepperi-addons/debug-server
Overview
A lightweight Express-based development server designed for local debugging of Pepperi addons. The server simulates the Pepperi runtime environment, enabling developers to:
- Test API endpoints locally without deployment.
- Debug server-side code directly within your IDE.
- Implement hot-reload workflows during active development.
- Serve addon assets from your local filesystem.
- Authenticate requests using JWT tokens, mirroring production behavior.
Requirements
- Node.js: >= 20.0.0
- npm: >= 10.0.0
- An existing Pepperi addon project.
Installation
npm install @pepperi-addons/debug-serverNote: If you are using the official Pepperi addon template, this package is included by default.
Quick Start
To get started, create an app.local.ts file in your addon's server-side directory:
import { DebugServer } from '@pepperi-addons/debug-server';
import config from '../addon.config.json';
const server = new DebugServer({
addonUUID: config.AddonUUID,
apiDirectory: __dirname,
port: config.DebugPort
});
// Configure static asset serving
server.addStaticFolder('/assets', './publish/assets');
// Start the debug server
server.start();
console.log(`Debug server running on http://localhost:${server.port}`);Execute the server:
ts-node app.local.tsPapilon Router Support
The debug server provides automatic support for Papilon router integration. When a router.js file is present in your API directory, the server automatically loads and configures it to handle requests routed to /router/*. This functionality enables local debugging of Babylon-executed API endpoints, maintaining parity with the production runtime environment.
Note: In order for the Babylon calls to get to your hosted addon, a rule set must be added to the Papilon SDK.
