Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/meteor/meteor/llms.txt

Use this file to discover all available pages before exploring further.

Meteor Core API

The Core Meteor API provides the fundamental building blocks for creating reactive, real-time applications. This includes core methods, reactivity, and essential utilities.

Meteor Namespace

The global Meteor namespace contains all core functionality available on both client and server.

Meteor.isClient

Meteor.isClient
boolean
Boolean variable that is true if running in a client environment.
if (Meteor.isClient) {
  // Code runs only on client
}

Meteor.isServer

Meteor.isServer
boolean
Boolean variable that is true if running in a server environment.
if (Meteor.isServer) {
  // Code runs only on server
}

Meteor.startup()

func
function
required
A function to run on startup.
Run code when the client or server starts.
Meteor.startup(() => {
  console.log('App started!');
});

Meteor.wrapAsync()

Wrap an asynchronous function to run synchronously using fibers.
func
function
required
An asynchronous function to wrap.
context
object
Optional this context for the function.
const wrappedFunction = Meteor.wrapAsync(asyncFunction);
const result = wrappedFunction(arg1, arg2);

Meteor.defer()

Defer execution of a function to run asynchronously after the current method finishes.
func
function
required
The function to defer.
Meteor.defer(() => {
  console.log('This runs after current execution context');
});

Meteor.absoluteUrl()

Generate an absolute URL pointing to the application.
path
string
A path to append to the root URL.
options
object
Options object.
options.secure
boolean
Create an HTTPS URL.
options.replaceLocalhost
string
Replace localhost with this hostname.
options.rootUrl
string
Override the default ROOT_URL.
const url = Meteor.absoluteUrl('/page');
// Returns: "http://localhost:3000/page"

const secureUrl = Meteor.absoluteUrl('/api', { secure: true });
// Returns: "https://localhost:3000/api"

Meteor.settings

Meteor.settings
object
Contains deployment-specific configuration. Settings are loaded from a JSON file specified with --settings.
// In settings.json:
// {
//   "public": {
//     "apiKey": "xyz"
//   },
//   "privateKey": "secret"
// }

// Client and server can access:
const apiKey = Meteor.settings.public.apiKey;

// Only server can access:
if (Meteor.isServer) {
  const privateKey = Meteor.settings.privateKey;
}

Meteor.release

Meteor.release
string
The name of the Meteor release with which the project was built, for example "METEOR@1.2.3".
console.log('Running Meteor version:', Meteor.release);

Environment Variables

ROOT_URL

Set the root URL for the application.
ROOT_URL=https://myapp.com meteor

MONGO_URL

Specify the MongoDB connection string.
MONGO_URL=mongodb://localhost:27017/myapp meteor

PORT

Set the port on which the application listens.
PORT=3000 meteor

Development Utilities

Meteor._debug()

Log a message with Meteor’s logging system. Uses console.error on the client.
Meteor._debug('Debug message', { data: 'value' });

Meteor.Error

Create a Meteor-specific error.
error
string|number
required
A numeric error code or string error type.
reason
string
Optional description of the error.
details
string
Optional additional details.
throw new Meteor.Error('not-authorized', 
  'You must be logged in',
  'Additional error details'
);