Skip to main content
This guide walks you through creating a basic Jan extension that listens to message events and provides custom responses.

Prerequisites

  • Node.js 18.0.0 or higher
  • Yarn package manager
  • Basic TypeScript knowledge
  • Jan application installed

Step 1: Set Up Your Project

Clone the Extension Template

Install Dependencies

Step 2: Update package.json

Edit package.json with your extension details:
package.json

Step 3: Create Your Extension

Edit src/index.ts:
src/index.ts

Step 4: Build Your Extension

Compile your extension:
This generates a dist/ folder with your compiled extension.

Step 5: Package Your Extension

Create a .tgz package:
This creates a file like myorg-my-extension-1.0.0.tgz.

Step 6: Install in Jan

  1. Open Jan application
  2. Go to Settings > Extensions
  3. Click Manual Installation
  4. Select your .tgz file
  5. Restart Jan if prompted

Step 7: Verify Installation

Check the console logs (Help > Toggle Developer Tools) to see:
Send a message containing “hello” and you should see:

Example: Advanced Extension with Settings

Let’s add settings to customize behavior:
src/index.ts

Example Extension Types

Inference Extension

Conversational Extension

Debugging Tips

  • Check the console for errors (Help > Toggle Developer Tools)
  • Verify package.json has correct main field pointing to dist/index.js
  • Ensure extension is built: yarn build
  • Try reinstalling the extension
  • Verify registerSettings() is called in onLoad()
  • Check setting configuration matches SettingComponentProps interface
  • Restart Jan after installing extension
  • Ensure you’re using the correct event name from @janhq/core
  • Check that events.on() is called after Jan finishes loading
  • Verify event handler function is bound correctly (use arrow functions)

Next Steps

Core API Reference

Explore all available APIs

Building Extensions

Learn packaging and distribution