Using the CLI
The easiest way to create a new piece is using the built-in CLI command: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…
- Create the piece directory structure
- Generate boilerplate code
- 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
- Metadata
- Authentication
- Actions & Triggers
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.pngPieceAuth
Authentication configuration. See Authentication
PieceCategory[]
Categories for organizing pieces:
COMMUNICATIONPRODUCTIVITYMARKETINGSALES_AND_CRMDEVELOPER_TOOLSANALYTICSCONTENT_AND_FILESCOMMERCE- 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
- OAuth2 authentication
- 20+ actions
- Multiple webhook triggers
- Block Kit support
GitHub Piece
- OAuth2 auth
- REST API integration
- GraphQL support
- Repository operations
Google Sheets
- OAuth2 with Google
- CRUD operations
- Bulk updates
- Dynamic dropdown
Airtable
- 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:42003
Create a Flow
- Click “Create Flow”
- Add a step
- Search for your piece
- Configure and test
Best Practices
Naming Conventions
Naming Conventions
- 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)
Logo Guidelines
Logo Guidelines
- Use official brand logos when possible
- PNG or SVG format
- Square aspect ratio (1:1)
- Upload to Activepieces CDN
- Fallback: Use a placeholder icon
Categories
Categories
- Choose the most relevant category
- Use only one primary category
- Consider how users will search for your piece
Versioning
Versioning
- Start with version
0.0.1 - Follow semantic versioning (SemVer)
- Set
minimumSupportedReleaseappropriately - 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