Fluid
The Fluid Framework is a library for building distributed, real-time collaborative web
applications using JavaScript or TypeScript.
Getting started using the Fluid Framework
You may be here because you want to...
- Learn more about the Fluid Framework
- Build a Fluid object
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.
Using Fluid Framework libraries
For a dependency on a Fluid Framework library's public APIs, we recommend a ^ (caret) version range.
For example, use ^1.3.4.
For a dependency on an unstable API, such as a beta API, we recommend a more restrictive version range.
For example, use a ~ version range.
Code structure
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:
Here's a list of other sets of other packages (each package within these groups is versioned independently,
forming its own release group):
- "Common" Packages: miscellaneous packages in the ./common directory and published under the
@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.
- "Tools" Packages: miscellaneous packages in the ./tools directory and published under a variety of namespaces.
Logically about the same as "Common", but most of the names include "tools" instead of "common".
- Auxiliary Microservice Packages (supporting Routerlicious)
- ./server excluding routerlicious, gitrest and historian (Published in the
@fluidframework/ namespace)
- ./docs: The code and content for https://fluidframework.com.
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.
- Note: to update the contents of
PACKAGES.md for local package changes, run pnpm layer-check --md ..
Setup and Building
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
[!WARNING]
Corepack cannot currently download an uncached pnpm version from publicPackages because Azure Artifacts does not support its single-version metadata endpoint.
corepack enable can succeed while the next pnpm command fails.
If direct npmjs access is blocked, use the npm-based pnpm bootstrap workaround.
[!NOTE]
Dependencies come from the public Azure Artifacts publicPackages feed.
Existing saved packages can be downloaded without credentials.
Maintainers need to authenticate to save new packages from npmjs.
See Dependency setup and changes for authentication, troubleshooting, and the maintainer-assisted workflow for external contributors.
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
Build in VSCode
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.
NodeJs Installation
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):
On Windows
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
On Unix
- Python v3.7, v3.8, v3.9, or v3.10
make
- A C/C++ toolchain (like GCC)
On MacOS
If you've upgraded your Mac to Catalina or higher, you may need to follow these instructions.
- Python v3.7, v3.8, v3.9, or v3.10
XCode Command Line Tools, which will install make, clang, and clang++
- You can install these by running
xcode-select --install from a command line.
Other Build Requirements
- Building server/Routerlicious
- Refer to that package's README for additional requirements.
- Note that these requirements do not affect all workflows (e.g. the one noted above), but will affect workflows that include the packages under
server.
On Windows
- Ensure that you have enabled running Powershell scripts by setting your environment's Execution Policy.
Other Build Commands
Building our docs
There are a few different areas in which we generate documentation content as a part our overall build.
- fluidframework.com
- We build the contents of our public website from the
docs directory under the root of this repo.
See its README for more details.
- Generated README contents
- We leverage a local tool (markdown-magic) to generate / embed contents in our various package-level READMEs.
This is done as a part of a full build, but it can also be executed in isolation by running
npm run build:readme from the repo root.
- API reports
- We leverage API-Extractor to generate summaries of our package APIs.
This is done as a part of a full build, but it can also be executed in isolation by running
npm run build:api from the repo root.
Common Workflows and Patterns
This section contains common workflows and patterns to increase inner dev loop efficiency.
Build
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