The Fluid Framework is a library for building distributed, real-time collaborative web applications using JavaScript or TypeScript.
You may be here because you want to...
Documentation and guides can be found at https://fluidframework.com/.
Hello World repo can be found at https://github.com/microsoft/FluidHelloWorld.
Core Examples repo can be found at https://github.com/microsoft/FluidExamples.
Have questions? Engage with other Fluid Framework users and developers in the Discussions section of our GitHub repo.
When taking a dependency on a Fluid Framework library's public APIs, we recommend using a ^ (caret) version range, such as ^1.3.4.
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
library consumers should always prefer ^.
If using any of Fluid Framework's unstable APIs (for example, its beta APIs), we recommend using a more constrained version range, such as ~.
The core code for both the Fluid client packages and the reference ordering service is contained within this repo.
The repo structure is somewhat unique because it contains several pnpm workspaces: some for individual packages and some for larger collections which we call "release groups". The workspaces are versioned separately from one another, but internally all packages in a workspaces are versioned together.
These workspaces do not align with package namespaces, and also don't always correspond to a single directory of this repo.
Here's the list of release group workspaces:
@fluidframework/ namespace, but some in @fluid-tools and unpublished packages in @fluid-internal/)@fluid-experimental/ namespace)@fluid-example/ namespace)@fluidframework/ namespace)@fluidframework/ namespace)@fluidframework/ namespace)@fluidframework/ namespace)@fluidframework/ and @fluid-tools/ namespaces)Here's a list of other sets of other packages (each package within these groups is versioned independently, forming its own release group):
@fluidframework/ namespace. Most of these (but not all) have "common" in their package name.
Packages which are used by multiple other groups of packages (such as built tools, linter configs and protocol definitions) live here.@fluidframework/ namespace)Dependencies between packages in various layers of the system are enforced via a build step called layer-check. You can view the full list of packages and layers in PACKAGES.md.
PACKAGES.md for local package changes, run pnpm layer-check --md ..Install the required tools:
Clone a copy of the repo and change to the repo root directory:
git clone https://github.com/microsoft/FluidFramework.git
cd FluidFramework
Enable NodeJs's corepack:
corepack enable
Run the following to build the client packages:
pnpm install
npm run build
You can use the worker mode to get faster build time as well: npm run build:fast
See also: Contributing
To build Fluid Framework within VSCode, open the Fluid Framework repo folder as a work space and use Ctrl-Shift-B
to activate the build task. It is the same as running npm run build on the command line.
We recommend using nvm (for Windows or MacOS/Linux) or fnm to install Node.js. This ensures you stay at the correct version while allowing other uses of NodeJS to use the (possibly different) versions they need side-by-side.
Because of a transitive dependency on a native addon module, you'll also need to ensure that you have the prerequisites for node-gyp.
Depending on your operating system, you'll have slightly different installation requirements (these are largely copied from node-gyp's documentation):
The node installer should ask if you want to install "Tools for Native Modules." If you check the box for this nothing further should be needed. Otherwise, you can follow the steps listed here
makeIf you've upgraded your Mac to Catalina or higher, you may need to follow these instructions.
XCode Command Line Tools, which will install make, clang, and clang++xcode-select --install from a command line.server.There are a few different areas in which we generate documentation content as a part our overall build.
docs directory under the root of this repo.
See its README for more details.npm run build:readme from the repo root.npm run build:api from the repo root.This section contains common workflows and patterns to increase inner dev loop efficiency.
From the root of the repository:
pnpm install to install dependencies. This is necessary for new clones or after pulling changes from the main branch.pnpm build:fast to perform an incremental build that matches the CI build process. Incremental builds tend to leave extra files laying around, so running a clean is sometimes needed to cleanup ghost tests.pnpm build:compile:esm:packages to perform an incremental build for production ESM code only. This a fast (minimal) build that can be used to check broad-reaching changes without noise from tests that might need adjusted.pnpm build:compile:esm to perform an incremental build for ESM production code and tests.pnpm [build:fast|build:compile:esm*] <path|name-regex>... to build only a specific part of the repository.From root or within a package:
pnpm build to build that package.pnpm build:compile for cross-package compilation.pnpm format to format the code.
fluid-build --vscode to output error message to work with default problem matcher in vscode. If fluid-build is not installed, please install it with npm i -g @fluidframework/build-tools.
fluid-build -t build <NAME_OF_PACKAGES> to build a multiple space-separated packages along with all their dependencies. If fluid-build is not installed, please install it with npm i -g @fluidframework/build-tools.You can also use the VSCode JS debug terminal, then run the test as normal.
Sometimes, uncommitted changes can cause build failures. Committing changes might be necessary to resolve such issues.
pnpm clean if random build failures, especially with no changesgit clean -Xdf to remove extraneous files if debugging becomes slow or hangs.git clean -xdf (lowercase x) can be used (after -Xdf for performance reasons) to clean up additional untracked (not staged) files, if there are any.It's a good idea to periodically run git maintenance run in the folder where you cloned the repository
(by default this will just run git's garbage collection)
to keep its size down and operations on it as snappy as possible.
Depending on your environment you might want to run git maintenance start instead,
which will schedule maintenance to run periodically.
- It should work on Windows because it leverages Task Scheduler.
- It won't work in WSL unless you configure it to use systemd,
which could have other implications for your system, so proceed with caution.
- It won't work on Codespaces because it doesn't run cron.
You can run:
pnpm testpnpm test command from the package you're interested inpnpm build-and-test <optional name-regex> (see specific package.json scripts). Note that test output will only be shown if there is a test error.Note: Some of the tests depend on test collateral that lives in a submodule here: https://github.com/microsoft/FluidFrameworkTestData. You may choose to fetch that collateral into your local repository, which is required to run all the tests - otherwise some will be skipped.
First, ensure you have installed Git LFS. Then, from the repo root:
git lfs install
git submodule init
git submodule update
Before running the tests, the project has to be built. Depending on what tests you want to run, execute the following command in the package directory or at the root:
npm run test
.only to it or describe. To exclude a test, use .skip.You can use ts-mocha to quickly run specific test files without needing to make the whole project compile. For more details on test filtering using CLI arguments, refer to the Mocha documentation.
Our test setup generally requires building before running the tests.
pnpm clean <package>
This removes any leftover files from previous builds, providing a clean testing environment.
npm run test:coverage
Our CI pipelines run on Linux machines, and the npm scripts all have the ci prefix.
To replicate the test st
$ claude mcp add FluidFramework \
-- python -m otcore.mcp_server <graph>