Declarative Configuration

Zephyr normally infers application identity from Git and package.json. Add an optional zephyr.config file when an application needs explicit identity, remote dependency declarations, immutable dependency URLs, or a React Native runtime manifest.

Create a Configuration File

For TypeScript projects, create zephyr.config.ts:

zephyr.config.ts
import { defineConfig } from 'zephyr-agent';

export default defineConfig({
  org: 'acme',
  project: 'storefront',
  appName: 'checkout',
  remoteDependencies: {
    header: 'zephyr:header.components.acme@production',
  },
  dependencyUrlMode: 'version',
});

defineConfig provides TypeScript types and returns the configuration unchanged. A plain object is also valid:

zephyr.config.ts
export default {
  appName: 'checkout',
};

All fields are optional. Use only the fields that need to differ from Zephyr's inferred values or default behavior.

Supported File Names

Zephyr supports TypeScript and JavaScript configuration files:

  • zephyr.config.ts
  • zephyr.config.mts
  • zephyr.config.cts
  • zephyr.config.js
  • zephyr.config.mjs
  • zephyr.config.cjs

ES modules can use a default export. CommonJS files can use module.exports:

zephyr.config.cjs
module.exports = {
  appName: 'checkout',
};

File Discovery

Zephyr starts at the bundler's project directory and searches upward. The nearest configuration file wins.

This allows a monorepo to use one configuration at its root or a closer file for an individual application. Configuration files at different levels are not merged. If a directory contains more than one supported zephyr.config file, Zephyr rejects the ambiguous configuration before deployment.

Zephyr resolves the configuration when the bundler initializes. Restart the bundler after changing the file.

Configuration Reference

FieldTypeDefault source or valuePurpose
orgstringInferred from the Git originOverrides the organization portion of the application identity.
projectstringInferred from the Git originOverrides the project portion of the application identity.
appNamestringNearest package.json nameOverrides the application name.
remoteDependenciesRecord<string, string>package.json zephyr:dependenciesAdds entries and overrides matching aliases.
dependencyUrlMode'selector' | 'version''selector'Chooses mutable selector URLs or immutable resolved-version URLs.
runtimeManifeststringNoneTag or environment whose manifest a React Native app follows at runtime.

The configuration is strict. Unknown fields, empty strings, non-string dependency references, and unsupported dependencyUrlMode values cause the build to fail.

org and project

Use org and project when the application identity should differ from the repository origin, or when no remote is available:

zephyr.config.ts
import { defineConfig } from 'zephyr-agent';

export default defineConfig({
  org: 'acme',
  project: 'storefront',
});

Either field can override its inferred value independently. Provide both when replacing Git remote identity completely. Explicit identity does not replace the Git branch and commit metadata required for CI deployments.

appName

Use appName when the Zephyr application name should differ from the nearest package.json name:

zephyr.config.ts
export default {
  appName: 'checkout',
};

Together, appName, project, and org form the application UID: appName.project.org.

remoteDependencies

remoteDependencies is the config-file alternative to package.json zephyr:dependencies:

zephyr.config.ts
export default {
  remoteDependencies: {
    header: 'zephyr:header.components.acme@production',
    recommendations: 'zephyr:recommendations@latest',
  },
};

You can use both locations. Zephyr merges them by alias: entries from remoteDependencies override same-named entries in package.json, while package-only entries remain.

A selector may contain ${target}, which Zephyr replaces with the build target, such as ios or android, when it resolves the dependency. Write such selectors in plain quotes, not template literals, so JavaScript does not interpolate them:

zephyr.config.cjs
module.exports = {
  remoteDependencies: {
    profile: 'zephyr:profile@production-${target}',
  },
};

See Remote Dependencies for application UID and version selector syntax.

dependencyUrlMode

The default selector mode preserves tag or environment URLs in the built host. If the selector later moves, the existing host can load the newly selected deployment.

Set dependencyUrlMode to version to embed the immutable URLs of the deployment selected at build time:

zephyr.config.ts
export default {
  dependencyUrlMode: 'version',
};

The selector still determines which deployment Zephyr resolves. The mode changes only the deployment root, remote entry, and Module Federation manifest URLs written into the host. Rebuild the host to adopt a newer dependency version.

runtimeManifest

runtimeManifest makes a React Native app whose bundle ships inside the native binary follow a Zephyr tag or environment at runtime. The selector uses zephyr:dependencies syntax: @label selects this application's own tag or environment, app@label another application's, and ${target} is replaced with the build platform:

zephyr.config.cjs
module.exports = {
  appName: 'mobile-shell',
  runtimeManifest: '@production-${target}',
};

Every integration accepts the field, but only the Metro and Re.Pack plugins act on it. Their withZephyr({ runtimeManifest }) option wins over the config file. The build resolves the label's alias URL, never a version URL, and reports an error when the label has no deployment for the build platform. Use separate labels per platform.

At runtime, the app applies the label's zephyr-manifest.json stored by the previous launch, with its remote overrides and ZE_PUBLIC_* values, then refreshes the stored copy in the background. It needs zephyr-native-cache registered. See React Native OTA Updates.

Alternatives and Precedence

You do not need a zephyr.config file when Zephyr's inferred values and defaults are correct.

ConcernWithout zephyr.configWith zephyr.config
OrganizationInferred from Git originorg overrides the inferred organization.
ProjectInferred from Git originproject overrides the inferred project.
Application nameRead from the nearest package.jsonappName overrides the package name.
Remote dependenciesDeclared in package.json under zephyr:dependenciesremoteDependencies adds entries and wins by alias.
Dependency URLsMutable selector URLsdependencyUrlMode: 'version' enables immutable URLs.
Runtime manifestBuild-time remotes and values in the native binaryruntimeManifest follows a tag or environment.

Environment variables are not an alternative configuration source for these fields. Zephyr does not read identity or remote dependency overrides from the environment, and loading the file does not copy values into process.env.