Skip to main content
Meteor packages are the primary way to extend Meteor’s functionality. This guide covers creating and publishing both core and community packages.

Package Structure

Every Meteor package requires a package.js file that defines metadata, dependencies, and files.

Basic Package.js

package.js

Core Package Example

Here’s a real example from packages/tracker/package.js:

Complex Package Example

From packages/mongo/package.js:

Package API Methods

Package.describe()

api.versionsFrom()

Specify compatible Meteor versions:

api.use()

Declare package dependencies:

api.addFiles()

Add source files to the package:

api.mainModule()

Specify the main entry point (recommended over addFiles):

api.export()

Export symbols globally:

api.addAssets()

Add non-code assets:

Npm.depends()

Declare npm dependencies:

Creating a Package

1

Create package structure

Use the Meteor command to scaffold a package:
2

Edit package.js

Update the package metadata and dependencies:
3

Write your code

Create your main module file:
main.js
4

Add tests

Write tests in your test file:
tests.js

Testing Packages

Local Testing

Test your package in a local app:

Running Package Tests

Testing from Meteor Checkout

When contributing to core packages:

Publishing Packages

Prerequisites

1

Ensure Meteor 3 compatibility

For Meteor 3 packages, specify the release:
2

Test thoroughly

Run all tests and verify functionality:
3

Write documentation

Create a comprehensive README.md with:
  • Installation instructions
  • Usage examples
  • API documentation

Publishing to Atmosphere

If you omit --release when publishing Meteor 3 packages, they may default to Meteor 2 compatibility and cause Fibers-related errors.

Version Bumping

Follow semantic versioning:
  • Patch (1.0.0 → 1.0.1): Bug fixes, no breaking changes
  • Minor (1.0.0 → 1.1.0): New features, backward compatible
  • Major (1.0.0 → 2.0.0): Breaking changes
For core packages:
  • Patch bump: Changes OK to release independently
  • Minor bump: Requires new Meteor release
  • Major bump: Major rewrite, requires new Meteor release

Core Package Contributions

When contributing to core Meteor packages:

Guidelines

  • Each package should stand separately
  • APIs should be consistent between client and server where possible
  • Prefer synchronous APIs (use Meteor.wrapAsync on server)
  • Don’t harm the new developer experience
  • Don’t preclude experts from advanced usage

Submitting Pull Requests

1

Propose your change

Create a Discussion to build consensus before coding
2

Wait for 'ready' label

Once labeled ready, leave a comment and start working
3

Include tests

All code changes must include tests
4

Bump version

Update version in package.js according to change type
5

Follow code style

Package Best Practices

Structure

  • Use api.mainModule() instead of api.addFiles() for modern packages
  • Organize code by feature, not by client/server
  • Use ES modules (import/export)

Dependencies

  • Minimize dependencies to reduce bloat
  • Use weak dependencies for optional integrations
  • Specify version constraints for stability

Exports

  • Only export public API symbols
  • Use testOnly: true for internal test helpers
  • Document all exported functions

Testing

  • Test both client and server code
  • Test integration with common packages
  • Include edge cases and error handling

Documentation

  • Clear README with examples
  • API reference for all exports
  • Changelog for version updates

Next Steps

Testing Guidelines

Learn how to write comprehensive tests

Release Process

Understand how Meteor releases work