<p align="center">
  <a href="https://ploterr.com/floorkit">
    <img src="https://ploterr.com/og/floorkit-introduction-v1.jpg" alt="Floorkit — TypeScript SDK for floor plans and building design" width="960" />
  </a>
</p>

<h1 align="center">Floorkit</h1>

<p align="center">
  <strong>Build apps that create and edit buildings, floor plans, and drawing sheets.</strong><br />
  A browser-based TypeScript SDK from Ploterr, powered by OpenGeometry.
</p>

<p align="center">
  <a href="https://ploterr.com/floorkit">Website &amp; licensing</a> ·
  <a href="https://docs.ploterr.com/floorkit">Documentation</a> ·
  <a href="https://floorkit-examples.ploterr.com/floorkit">Live examples</a> ·
  <a href="https://www.npmjs.com/package/@opengeometry/floorkit">npm</a>
</p>

## What you can build

Use Floorkit for floor-plan editors, browser CAD, architectural tools, property apps, and AI-assisted design. People and AI agents can work with the same saved building data.

- **Model a building.** Add straight and curved walls, doors, windows, slabs, roofs, stairs, and rooms. A door in a wall creates a real opening. Place furniture and fixtures from the free [block catalog](https://docs.ploterr.com/floorkit/guides/use-the-block-catalog).
- **Let people edit.** Connect 2D and 3D editors to one project, with snapping, undo, and redo.
- **Save the design.** Keep building data, named views, and sheets in one JSON project file.
- **Produce drawings.** Make plans, straight sections, exterior elevations, and SVG/PDF sheets. Export the 3D model as GLB.

Your app owns its interface, Three.js scene, storage, and AI model. Floorkit supplies building data, geometry, supported edit commands, and drawings. It is ESM, includes TypeScript declarations, and needs no UI framework or geometry server.

| You want to build                             | Start here                                                                                                                                          |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| An AI app that generates editable floor plans | [Agent building workflow](https://docs.ploterr.com/floorkit/agents/agent-building-workflow)                                                         |
| A browser CAD or architectural editor         | [Plan editor](https://docs.ploterr.com/floorkit/guides/add-a-plan-editor) and [3D editor](https://docs.ploterr.com/floorkit/guides/add-a-3d-editor) |
| An app with property plans and room areas     | [Property and space-planning workflow](https://docs.ploterr.com/floorkit/use-cases#property-apps-and-space-planning)                                |
| A tool that generates architectural sheets    | [Drawing workflow](https://docs.ploterr.com/floorkit/use-cases#architecture-and-bim-tools)                                                          |
| Geometry inside an existing Three.js app      | [Three.js integration](https://docs.ploterr.com/floorkit/guides/use-your-threejs-scene)                                                             |

## Install

```bash
npm install @opengeometry/floorkit three@^0.168.0 camera-controls@^2.9.0 opengeometry@^3.0.0
npm install --save-dev @types/three@^0.168.0
```

`three` and `camera-controls` are peer packages. Install `opengeometry` directly too: the Vite example below imports its WebAssembly file and its worker file. TypeScript needs `vite/client` types for `?url` imports. With Vite, keep the kernel out of the dependency pre-bundle with `optimizeDeps: { exclude: ['opengeometry'] }`. Deploy the emitted `.wasm` and worker files with your app.

Starting from an empty folder? Follow the [complete Vite quickstart](https://docs.ploterr.com/floorkit/quickstart), including project creation, the page, and the render loop.

## Create a saved building

This example runs in a browser app on `localhost`. It creates a six-by-four-metre room with a door, a plan view, and one project owner.

```typescript
import { Floorkit, ProjectManager, type BuildingModel } from '@opengeometry/floorkit';
import wasmURL from 'opengeometry/opengeometry_bg.wasm?url';
import workerURL from 'opengeometry/tessellation-worker.js?url';

export async function createRoomProject(): Promise<ProjectManager> {
  await new Floorkit().setupOpenGeometry(wasmURL, { workerURL });
  const buildingModel: BuildingModel = {
    schema: 'floorkit.building-model',
    version: 3,
    units: 'meters',
    upAxis: 'y',
    id: 'garden-house',
    buildings: [
      {
        id: 'building',
        storeys: [
          {
            id: 'ground',
            elevation: 0,
            height: 3,
            walls: [
              {
                id: 'room-walls',
                points: [
                  [0, 0],
                  [6, 0],
                  [6, 4],
                  [0, 4],
                ],
                closed: true,
                thickness: 0.2,
                openings: [
                  { id: 'entry-door', kind: 'door', offset: 1.5, width: 0.9, height: 2.1 },
                ],
              },
            ],
          },
        ],
      },
    ],
  };
  return new ProjectManager({
    schema: 'floorkit.project',
    version: 3,
    buildingModel,
    views: [
      {
        id: 'ground-plan',
        name: 'Ground floor plan',
        kind: 'plan',
        storeyId: 'ground',
        cutHeightAboveStorey: 1.2,
      },
    ],
    paper: { version: 1, unitSystem: 'metric', sheets: [] },
  });
}

export function moveDoorAndSave(manager: ProjectManager): string {
  manager.apply({
    kind: 'move-hosted-opening',
    buildingId: 'building',
    storeyId: 'ground',
    wallId: 'room-walls',
    openingId: 'entry-door',
    offset: 2.5,
  });
  return manager.save();
}
```

Await `createRoomProject()` and add `manager.root` to your Three.js scene. For an editable plan, call `await manager.mountPlanEditor(container, 'ground-plan')`. The container needs a width and height. Your app supplies the camera, lights, and render loop.

`manager.save()` returns project text to store. Reopen it with `ProjectManager.open(text)` after kernel initialization. Remove `manager.root` from your scene and call `manager.dispose()` when you close the project. See [save and reopen](https://docs.ploterr.com/floorkit/guides/save-and-reopen).

**Lengths are in metres; Y is up.** Wall points are `[x, z]`. Door offsets are measured along the wall from its first point. Sheet sizes use millimetres. Initialize the kernel once before constructing geometry; text-backed dimensions and datums also need `await setGlyphScene(scene, camera)`.

## Choose the right API

| Workflow                                             | API                                                    | What owns the data                                     |
| ---------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------ |
| Build an app with editing, views, sheets, and saving | `ProjectManager`                                       | One project and one undo history                       |
| Work with building data and commands directly        | `BuildingModel`, `BuildingSession`                     | The model stores the design; the session applies edits |
| Create individual geometry objects                   | `WallNetwork`, `Wall`, `Door`, `Window`                | Your app owns the live objects                         |
| Draw and export sheets                               | `drawProjectView`, `exportProjectPdf`, `PaperExporter` | Views and sheets describe drawings made from the model |
| Read, check and edit saved data with nothing drawn   | `@opengeometry/floorkit/model`                         | The saved model; no three.js, jspdf or kernel loaded   |

Use commands for saved edits. Changing a live object or a Three.js mesh directly does not update the saved building model. [How Floorkit works](https://docs.ploterr.com/floorkit/concepts/architecture) explains these paths.

### Floorkit or OpenGeometry?

Choose **Floorkit** for building elements, architectural editing, saved projects, and drawings. Choose the **[OpenGeometry kernel](https://docs.opengeometry.io/OpenGeometry/what-is-opengeometry)** for lower-level solid geometry, extrusion, booleans, and custom modelling tools. Floorkit uses that kernel; the packages have different APIs and licenses.

## Use Floorkit with an agent

Start with [Build with agents](https://docs.ploterr.com/floorkit/agents/index). It covers coding agents that integrate the SDK and agents that generate or edit designs inside your app.

- [Documentation index](https://docs.ploterr.com/llms.txt): find the relevant guides and API pages.
- [Documentation MCP setup](https://docs.ploterr.com/floorkit/agents/use-a-coding-agent#connect-documentation-search-through-mcp): search and retrieve current docs from an MCP client. It does not edit your building.
- Markdown pages: append `.md` to a docs page, for example [quickstart.md](https://docs.ploterr.com/floorkit/quickstart.md).
- [Model validation](https://docs.ploterr.com/floorkit/api/architecture/validate-building-model): check unknown JSON and return paths, codes, and messages to the agent.

Your app chooses the AI provider. Floorkit does not include a hosted LLM or generate plans from a prompt by itself. Match API examples to your installed version and its `index.d.ts`; use supported commands and preserve element IDs. The [agent workflow](https://docs.ploterr.com/floorkit/agents/agent-building-workflow) covers validation, edits, stale proposals, and saving.

## Current support

PDF sheets, GLB models, and editable JSON project files are available. SVG drawings are available through the paper APIs. **IFC and DXF exports are coming in the next release.** They are not supported production exchange routes today.

Plans, sections and elevations draw curved walls, and slabs and flat roofs with arcs, as true curves; a section or elevation through a curved wall with a round hole is refused. Physical sections use straight cut lines; elevations look from outside the building. Isometric views on sheets use captured images and need a supplied browser/WebGL renderer, and vector isometric drawings have limitations. Floorkit does not certify structural, MEP, permitting, or building-code compliance. See [drawings](https://docs.ploterr.com/floorkit/concepts/drawings) and [exports](https://docs.ploterr.com/floorkit/concepts/exports) before selecting an export route.

## License and deployment

Floorkit is proprietary software. Development on `localhost`, `*.localhost`, loopback addresses, and runs outside a browser is free. Keep the **made with floorkit** badge visible wherever it appears. **Every deployed website needs a valid key for its hostname**, including public prototypes and non-commercial demos. Trial keys keep the badge; paid keys remove it.

For a deployed Vite app, apply the key before views or exports, then initialize the kernel:

```typescript
import { setLicenseKey } from '@opengeometry/floorkit';

export async function initializeLicensedKernel(): Promise<void> {
  const key = import.meta.env.VITE_FLOORKIT_LICENSE_KEY;
  const floorkit = new Floorkit({ licenseKey: key });
  await setLicenseKey(key);
  await floorkit.setupOpenGeometry(wasmURL, { workerURL });
}
```

Use this initialization in place of the localhost setup in `createRoomProject`. Without a valid key, deployed views stop after five seconds and SDK exports fail with `LicenseError`. Saving remains available. Use HTTPS and apply the key separately in each worker that uses the SDK.

The SDK sends limited usage reports to `https://license.ploterr.com`, excluding project content and page paths. `telemetry: false` disables development reporting; deployed reporting cannot be disabled. Read [licensing](https://docs.ploterr.com/floorkit/licensing) for integration details. `LICENSE.md` in the package contains the terms. Ask about [licenses and special pricing for startups and solo businesses](https://ploterr.com/floorkit).

## Resources and community

[API reference](https://docs.ploterr.com/floorkit/api/overview) · [Use cases](https://docs.ploterr.com/floorkit/use-cases) · [Block catalog](https://github.com/OpenGeometry-io/floorkit-catalog) · [Troubleshooting](https://docs.ploterr.com/floorkit/troubleshooting) · [Changelog](https://docs.ploterr.com/floorkit/changelog)

Report a bug or request a feature on [Discord](https://discord.gg/zCCbputRYp) · [OpenGeometry](https://opengeometry.io)
