Skip to main content

Using the CLI

The easiest way to create a new piece is using the built-in CLI command:
This interactive command will prompt you for:
1

Piece Name

Enter the name of your piece (e.g., my-service)
  • Use lowercase with hyphens
  • Must be unique across all pieces
2

Display Name

The human-readable name shown in the UI (e.g., My Service)
3

Description

A brief description of what your piece does
4

Category

Choose from categories like:
  • Communication
  • Productivity
  • Marketing
  • Developer Tools
  • And more…
The CLI will:
  1. Create the piece directory structure
  2. Generate boilerplate code
  3. Add the piece to the workspace configuration

Piece Structure

After running the CLI, your piece will have this structure:

Anatomy of a Piece

Let’s look at a real example from the GitHub piece:
packages/pieces/community/github/src/index.ts

Key Components

Example: Building a Simple Piece

Let’s create a simple weather service piece:
1

Create the Piece

2

Define Authentication

src/lib/auth.ts
3

Create Main File

src/index.ts
4

Add Package Configuration

package.json

Piece Configuration Options

string
required
The name shown in the Activepieces UI
string
A brief description of the piece’s functionality
string
required
URL to the piece logo (PNG or SVG). Should be hosted on CDN: https://cdn.activepieces.com/pieces/your-piece.png
PieceAuth
Authentication configuration. See Authentication
PieceCategory[]
Categories for organizing pieces:
  • COMMUNICATION
  • PRODUCTIVITY
  • MARKETING
  • SALES_AND_CRM
  • DEVELOPER_TOOLS
  • ANALYTICS
  • CONTENT_AND_FILES
  • COMMERCE
  • And more…
string
Minimum Activepieces version required (e.g., "0.30.0")
string
Maximum supported version (optional, for deprecation)
string[]
GitHub usernames of piece contributors
Action[]
required
Array of action definitions. See Create Action
Trigger[]
Array of trigger definitions. See Create Trigger

Real-World Examples

Look at these community pieces for inspiration:

Slack Piece

Full-featured piece with:
  • OAuth2 authentication
  • 20+ actions
  • Multiple webhook triggers
  • Block Kit support

GitHub Piece

Complex piece with:
  • OAuth2 auth
  • REST API integration
  • GraphQL support
  • Repository operations

Google Sheets

Data-focused piece:
  • OAuth2 with Google
  • CRUD operations
  • Bulk updates
  • Dynamic dropdown

Airtable

Database piece with:
  • API Key auth
  • Record management
  • Field mapping
  • Attachment handling

Testing Your Piece

Once created, test your piece locally:
1

Start Dev Server

2

Open Activepieces

Navigate to http://localhost:4200
3

Create a Flow

  • Click “Create Flow”
  • Add a step
  • Search for your piece
  • Configure and test
Use hot reloading! Changes to your piece code are reflected immediately without restarting.

Best Practices

  • Piece name: lowercase-with-hyphens (e.g., my-service)
  • Display name: Title Case (e.g., My Service)
  • Export name: camelCase (e.g., export const myService = createPiece(...))
  • Action/Trigger names: camelCase with suffix (e.g., sendMessageAction)
  • Use official brand logos when possible
  • PNG or SVG format
  • Square aspect ratio (1:1)
  • Upload to Activepieces CDN
  • Fallback: Use a placeholder icon
  • Choose the most relevant category
  • Use only one primary category
  • Consider how users will search for your piece
  • Start with version 0.0.1
  • Follow semantic versioning (SemVer)
  • Set minimumSupportedRelease appropriately
  • Document breaking changes

Next Steps

Add Authentication

Configure OAuth2, API keys, or custom auth

Create Actions

Add actions that perform operations

Create Triggers

Add triggers that start flows

Properties Guide

Learn about all property types