Skip to main content
The webapp package provides Meteor’s built-in HTTP server, serving your application over HTTP and managing client-server communication.

Installation

The webapp package is included by default in all Meteor applications.

Overview

WebApp provides:
  • HTTP Server - Built on Express 5.x
  • Static Asset Serving - Automatic bundling and serving of client files
  • Middleware Support - Express middleware integration
  • WebSocket Support - For DDP connections via SockJS
  • Hot Code Push - Automatic client updates
  • Modern/Legacy Bundles - Differential serving based on browser capabilities

Package Information

  • Version: 2.1.0
  • Summary: Serves a Meteor app over HTTP
  • Dependencies: express@5.1.0, compression@1.7.4, cookie-parser@1.4.6
  • Exports: WebApp (server), WebAppInternals (server)

Basic Usage

Server-Side Exports

Client-Side

Express Integration

WebApp is built on Express 5.x. You can add middleware to the Connect/Express server:

Adding Middleware

Custom Routes

Using Express Middleware

Raw Connect Handlers

HTTP Handlers

Request Handler

Response Manipulation

Static File Serving

Custom Static Files

Download Handler

Client Serving

Modify HTML Before Serving

Runtime Config

Suppressing Default Behavior

Suppress Connect Handlers

Server Listening

Get Server Instance

Custom Port and Host

Compression

WebApp includes automatic response compression:

Security Headers

WebApp includes cookie-parser:

Request Logging

Error Handling

Client Hash

WebApp provides version information for cache busting:

Hot Code Push

Detect Reload

Customize Reload Behavior

Modern vs Legacy Bundles

WebApp serves different JavaScript bundles based on browser capabilities:

WebSocket Configuration

Complete Example: REST API

Performance Tips

Enable compression - WebApp includes compression middleware by default
Cache static assets - Set appropriate cache headers for static files
Use CDN - Serve static assets from a CDN in production

ddp

DDP protocol over WebSocket

autoupdate

Hot code push system

boilerplate-generator

HTML generation for client

browser-policy

Security headers and CSP

Source Code