Overview
Meteor uses a powerful package system that enables modular application development. Packages can contain JavaScript, CSS, assets, and even build plugins that extend the build system.Meteor has over 140 core packages and thousands of community packages available through Atmosphere.
Package Types
Core Packages
Core packages are maintained in the official Meteor repository atpackages/. They are:
- Released together with Meteor tool versions
- Don’t have
.versionsfiles (always released from checkout) - Located directly in
packages/(not in subdirectories)
Non-Core Packages
Packages inpackages/non-core/ or packages/deprecated/ are:
- Not considered core packages
- May have different release schedules
- Often for backwards compatibility
jquery, coffeescript, less, mongo-decimal
Community Packages
Published to Atmosphere by the community:npm Packages
Meteor fully supports npm packages:Package Structure
Every Meteor package has apackage.js file that defines its metadata and configuration.
Basic package.js
package.js
Real Example: meteor Package
The coremeteor package (packages/meteor/package.js):
Real Example: DDP Package
Theddp package demonstrates package composition:
packages/ddp/package.js
Package API
Thepackage.js API provides several key methods:
Package.describe
Defines package metadata:api.use
Declares dependencies:api.imply
Makes dependencies available to package users:ecmascript package:
packages/ecmascript/package.js
api.export
Exports symbols globally:api.addFiles
Adds source files to the package:api.addAssets
Adds non-JS files:Core Package Domains
Meteor’s 140+ core packages are organized by functionality:Authentication & Accounts
accounts-base
Core authentication system
accounts-password
Username/password authentication
accounts-oauth
OAuth integration base
accounts-2fa
Two-factor authentication
accounts-google, accounts-facebook, accounts-github, accounts-twitter, etc.
Database & Data
mongo
MongoDB driver and collections
minimongo
Client-side MongoDB implementation
ddp-server
Server-side DDP implementation
ddp-client
Client-side DDP implementation
Build & Compilation
ecmascript
ES2015+ compilation via Babel
babel-compiler
Babel integration for build plugins
typescript
TypeScript support
rspack
Modern bundler integration
Reactivity
tracker
Reactive computation system
reactive-var
Single reactive value
reactive-dict
Reactive key-value store
session
Global reactive dictionary
Web Server
webapp
HTTP server (Express-based)
autoupdate
Hot code push to clients
reload
Client reload coordination
server-render
Server-side rendering support
Build Plugins
Packages can register build plugins that extend the build system:Compiler Plugin
Plugin Types
Compiler Plugin
Compiler Plugin
Compiles source files (e.g.,
.jsx, .ts, .vue)Minifier Plugin
Minifier Plugin
Minifies JavaScript and CSS
Linter Plugin
Linter Plugin
Lints source code during build
npm Dependencies
Packages can declare npm dependencies:meteor package:
packages/meteor/package.js
Package Dependencies Resolution
Meteor uses a constraint solver to determine package versions:- Reads package constraints from
.meteor/packages - Resolves compatible versions using constraint solver
- Writes resolved versions to
.meteor/versions - Downloads and caches packages
.meteor/packages
.meteor/versions
Creating Packages
Local Package
Create a package in your app:Publishing to Atmosphere
Best Practices
Minimize Dependencies
Minimize Dependencies
Only depend on packages you actually need. Each dependency adds to bundle size and complexity.
Use api.imply Carefully
Use api.imply Carefully
Only imply packages that are part of your public API:
Version Constraints
Version Constraints
Specify version constraints for stability:
Architecture Targeting
Architecture Targeting
Be explicit about where code runs:
Next: Isobuild
Learn how Meteor’s build system compiles and packages your code