The `fluid-framework` package serves as the primary client-side entry point for building collaborative applications with Fluid Framework. It bundles core Fluid Framework client libraries, including the `IFluidContainer` interface and various Distributed Data Structures (DDSes) like `SharedTree` and the now legacy `SharedMap`. The current stable version is 2.93.0, with minor releases occurring frequently, often including new features and breaking changes. This package abstracts away many individual Fluid package dependencies, simplifying development. While it provides the core collaborative primitives, it requires a separate service client (e.g., `@fluidframework/azure-client` or `@fluidframework/tinylicious-client`) to connect to a Fluid service. Its key differentiators include real-time, low-latency collaboration primitives, robust data modeling with `SharedTree`, and a comprehensive API for managing collaborative sessions.
npm install fluid-frameworkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create or load a Fluid container, initialize a SharedTree with a defined schema, and interact with its collaborative data, including event listeners for changes.
Ensure that `minVersionForCollab` is explicitly set within your container configuration object, typically when calling `createContainer()` or `getContainer()` via a service client. A common value is `1` for basic scenarios.
Migrate your React-based Fluid applications to use ECMAScript Modules (ESM) for imports. This generally involves setting `"type": "module"` in your `package.json` and ensuring your build system is configured to output ESM.
Update your event listener signatures for the `IDirectory.cleared` event to accommodate the newly added `path` parameter.
Refactor your code to avoid using number keys directly in `LatestMap`. Convert number keys to strings before using them, or consider migrating to `SharedTree` if structured data with numeric identifiers is a core requirement.
For all new development and for migrating existing `SharedMap` instances, it is strongly recommended to use `SharedTree` instead, as it offers enhanced capabilities, better type safety, and is the actively developed DDS for collaborative data modeling.
Always ensure you are importing APIs from their correct subpath according to their stability level. Using unstable APIs carries risks and requires a more constrained version range (`~`) in your `package.json`.
Configure your `package.json` dependencies with `"fluid-framework": "^x.y.z"` for public APIs and `"fluid-framework/beta": "~x.y.z"` for beta/alpha APIs to manage stability risks effectively.
Add `{ minVersionForCollab: 1 }` or an appropriate version to your `containerSchema` when calling `client.createContainer()` or `client.getContainer()`.Configure your project for ECMAScript Modules (ESM) by setting `"type": "module"` in your `package.json` and using `import` statements.
Import beta APIs from `fluid-framework/beta` and alpha APIs from `fluid-framework/alpha`. For example: `import { TreeAlpha } from 'fluid-framework/alpha';`.Convert number keys to strings before using them in `LatestMap`, or refactor to use `SharedTree` for structured data where numeric identifiers can be modeled differently.