Reference
CLI
The mreact-router CLI is the operational entrypoint for local development, server/client boundary inspection, production builds, serving Node output, and packaging adapter artifacts. Use command-level help when you need the exact option list for the installed version.
When to use this page
Use this page when you need to choose the right CLI command, inspect which components run on the server or client, map an npm script to a build target, enable request logging, or create deployment artifacts from an existing .mreact build.
Commands
mreact-router devstarts the Vite-backed development server. It is the default when no command is provided.mreact-router boundaries [appDir]analyzes every route and lists its statically traceable rendered server and client components without creating build artifacts.mreact-router build --target=nodebuilds Node server output and client assets into.mreact.mreact-router build --target=cloudflarebuilds Cloudflare-compatible output.mreact-router build --target=aws-lambdabuilds AWS Lambda-compatible output.mreact-router build --target=allwrites every supported target in one build.mreact-router startserves the built Node target.mreact-router package aws-lambdacreates a minimal AWS Lambda package directory from existing build output.mreact-router package cloudflare-pagescreates a Cloudflare Pages advanced-mode artifact with_worker.js.
mreact-router dev --host 0.0.0.0 --port 3001 --log requests
mreact-router boundaries
mreact-router boundaries --json
mreact-router build --target=node --client-source-maps=hidden
mreact-router build --target=aws-lambda
mreact-router package aws-lambda --from .mreact --out .lambdaOptions to know first
mreact-router boundaries --jsonprints a deterministic, versioned JSON document for tooling. Paths are relative to the project root.--target=node|cloudflare|aws-lambda|allcontrols which production artifact is built.--client-source-maps=none|hiddencontrols production browser source maps. Usehiddenwhen you upload maps to Sentry or another error pipeline without publishing source map comments to browsers.mreact-router devreads--hostand--port.mreact-router startreads--host,--port,--host-policy, and--allowed-hosts. The--portflag overridesPORT; the default is3001.--log requestsenables compact request logs.MREACT_ROUTER_LOG=requestsenables the same mode from the environment.--fromand--outselect packaging input and output directories after a build.--handler <entry>bundles a custom AWS Lambda handler.--worker <entry>bundles a custom Cloudflare Pages worker that can importcreateDefaultCloudflarePagesHandlerfrom the package-timemreact-router/generated-cloudflaremodule.--skip-runtime-dependency-checkapplies to AWS Lambda packaging when a later deployment step installs production dependencies.
Boundary reports
The boundary report classifies each route as server-render or client-route, then lists every rendered component that static analysis can trace through pages, layouts, templates, and barrel exports. Component classifications distinguish server-render, server-only, client-boundary, client-route, shared, and unknown code, and origins explain explicit filename or directive boundaries versus inferred client runtime.
Every production build prints the same full route-by-route report before it builds server and client artifacts. The build reuses its existing production boundary analysis rather than scanning the graph a second time.
Dynamic component selection that cannot be resolved statically is reported as a diagnostic or unknown; the report does not execute application code. The standalone command reads the same Vite plugins as a configured production build, but it does not write .mreact or start a server.
Package scripts
Keep application scripts explicit about the target they produce. That makes CI logs and deployment jobs easier to read.
{
"scripts": {
"dev": "mreact-router dev",
"build": "mreact-router build --target=node",
"build:cloudflare": "mreact-router build --target=cloudflare",
"build:lambda": "mreact-router build --target=aws-lambda",
"start": "mreact-router start"
}
}Related pages
API reference: analyzeAppBoundaries(), buildApp(), startServer(), packageAwsLambdaArtifact(), and packageCloudflarePagesArtifact().