Skip to main content
This guide walks you through the complete path from a blank project to a working federated app: install the packages, configure and build a remote, load it from a host page, and set up TypeScript types so loadRemote is fully typed. No bundler plugin is required at any step.
1

Install packages

Install the runtime as a regular dependency and the CLI as a dev dependency. Add optional packages only as you need them.
2

Create knit.config.json for the remote

In your remote application’s root directory, create a knit.config.json file. The name field becomes the prefix consumers use in loadRemote. The shared array lists packages that should resolve to a single instance across the host and all remotes. The exposes array lists the entry points this remote makes available.
knit.config.json
The name field must be lowercase and match the pattern [a-z][a-z0-9_-]*. It is used as the prefix in loadRemote("checkout/CartWidget") — the host uses this exact string to address your remote.
3

Build the remote

Run the knitkit build command from your remote’s root directory. The CLI bundles each shared dependency from node_modules into an individual ESM file, bundles each exposed entry point, and writes a manifest with SRI integrity hashes.
The output lands in dist/ with this structure:
Serve the dist/ directory from any static host, CDN, or local dev server. All URLs in the manifest are relative to the manifest’s own URL, so the remote is portable across environments without rebuilding.To generate TypeScript declarations alongside the manifest, run:
This emits dist/types/*.d.ts and records each types URL inside the manifest so knitkit types sync on the host side can download them automatically.
4

Load the remote from a host

The one hard rule when loading remotes in the browser: inject the import map before the first module import that resolves through it. Use a small bootstrap script at the top of your HTML to register remotes and inject the map, then dynamically import the rest of your application.
index.html
After bootstrapping, call loadRemote anywhere in your application code:
src/main.ts
If you are using React, use <RemoteComponent> from @knitkit/react instead. It handles lazy loading, Suspense, and error boundaries automatically.
src/App.tsx
5

Type your remotes

Create a knit.host.json file in the host project’s root. This tells the CLI which remote manifests to fetch types from and where to write the downloaded declarations.
knit.host.json
Run the sync command to download each remote’s .d.ts files and generate a module augmentation that makes loadRemote fully typed:
Finally, add the types directory to your tsconfig.json so TypeScript picks up the augmentations:
tsconfig.json
After syncing, loadRemote("checkout/CartWidget") returns the exact type of that component’s default export — full autocomplete and type checking, no manual declarations needed.
Ready to go deeper? Check out the browser host guide for a full walkthrough including CSP headers and SRI enforcement, the Node SSR guide for server-side rendering, and the React integration guide for advanced <RemoteComponent> patterns.