Skip to main content

Publishing Plugins

Learn how to package, document, and publish your Genkit plugins to npm so others can use them.

Prerequisites

  • Node.js and npm installed
  • npm account (sign up here)
  • TypeScript knowledge
  • Completed plugin implementation

Package Structure

Package Configuration

package.json

Important fields:
  • name - Use genkitx-* prefix for community plugins
  • keywords - Include genkit-plugin for discoverability
  • peerDependencies - Require genkit as peer dependency
  • files - Only include necessary files (lib, README, LICENSE)
  • exports - Support both CommonJS and ESM

tsconfig.json

.npmignore

Naming Conventions

Package Names

Official plugins (by Firebase/Google):
  • @genkit-ai/plugin-name - e.g., @genkit-ai/anthropic
Community plugins:
  • genkitx-plugin-name - e.g., genkitx-ollama, genkitx-pinecone
Avoid:
  • Names starting with genkit- (reserved for official packages)
  • Generic names like genkit-ai-plugin

Keywords

Include relevant keywords for npm search:

Documentation

README.md Template

API Documentation

Document all exported functions and types:

Testing

Unit Tests

Publishing to npm

First-time Setup

  1. Create npm account:
  1. Verify login:

Publishing Steps

  1. Build the package:
  1. Test locally:
  1. Run tests:
  1. Update version:
  1. Publish:

Scoped Packages

For organization packages:

Best Practices

1. Semantic Versioning

Follow semver:
  • Major (1.0.0 -> 2.0.0) - Breaking changes
  • Minor (1.0.0 -> 1.1.0) - New features, backward compatible
  • Patch (1.0.0 -> 1.0.1) - Bug fixes

2. Changelog

Maintain a CHANGELOG.md:

3. License

Use Apache-2.0 to match Genkit:

4. Types

Always include TypeScript declarations:

5. Peer Dependencies

Use peerDependencies for Genkit:

6. Security

  • Don’t include API keys in code or tests
  • Add .env to .gitignore
  • Use environment variables for secrets
  • Document security best practices

7. Examples

Provide working examples:

Maintenance

Responding to Issues

  • Triage issues promptly
  • Label issues appropriately
  • Provide clear reproduction steps
  • Fix critical bugs quickly

Keeping Up-to-date

  • Monitor Genkit releases
  • Update peer dependency versions
  • Test against new Genkit versions
  • Update documentation

Deprecation

If deprecating features:

Promotion

Share Your Plugin

  1. Genkit Discord - Announce in #plugins channel
  2. GitHub - Add genkit-plugin topic to repository
  3. Twitter/X - Share with #Genkit hashtag
  4. Blog post - Write about your plugin
  5. Documentation - Submit PR to genkit-ai/docsite

Badge for README

Resources

Checklist

Before publishing:
  • Tests pass
  • Documentation complete
  • README with examples
  • LICENSE file included
  • Keywords in package.json
  • TypeScript declarations
  • Semantic version number
  • Changelog updated
  • No API keys in code
  • Peer dependencies correct
  • npm pack and test locally