# Installation

The system comes with its own tool, `fndn`. It sets a project up, adds components as files the project owns, prints a component's documentation for the project's framework, and checks the code against the rules the components follow. It is a command line and an MCP server in one package, and the components are inside it: adding one downloads nothing. It needs a React, Vue 3 or Svelte 5 project with Tailwind 4.

## 1. Tailwind 4

Every recipe is a list of Tailwind classes, so the project needs Tailwind 4 and its Vite plugin, and a global stylesheet that starts with `@import "tailwindcss";`.

```bash
npm install tailwindcss @tailwindcss/vite
```

**React**

`vite.config.ts`

```ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [react(), tailwindcss()],
});
```

**Vue**

`vite.config.ts`

```ts
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [vue(), tailwindcss()],
});
```

**Svelte**

`vite.config.ts`

```ts
import { defineConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [tailwindcss(), sveltekit()],
});
```

## 2. Set the project up

```bash
npx fndn init
```

It reads the framework from `package.json` (`--framework` to say it) and writes:

- `fndn.json`: the framework, the app's shape (`"shape": "pill"` or `"rounded"`), the folder the library lives in (`src/components/ui`; Svelte: `src/lib/components/ui`; `--dir` to choose another) and a hash of every file the tool writes, which is how it tells its files from your changes;
- `<folder>/styles/`: the stylesheet (the tokens for light and dark, the theme that turns them into utilities such as `bg-surface`, `rounded-control` and `motion-colors-fast`, a few global rules), and one line in your global stylesheet that imports it right after Tailwind;
- the fonts the system is drawn for, Inter and JetBrains Mono: two more import lines (`@fontsource-variable/inter`, `@fontsource-variable/jetbrains-mono`, which its install line names; `--no-fonts` leaves them out and the type falls back to the system font);
- `.claude/skills/fndn/`: the skill that tells a coding agent how to build with the system (`--no-skill` leaves it out).

Dark mode: the tokens switch under `class="dark"` or `data-theme="dark"` on an ancestor (usually `<html>`); following `prefers-color-scheme` is the app's choice. Shape: buttons, toggles and segmented controls are pills; `"shape": "rounded"` in `fndn.json` (`npx fndn init --shape rounded`, or edit it and run `npx fndn update`) gives them a field's corners everywhere, with no prop on each. Right-to-left: set `dir="rtl"` on `<html>`, and wrap the app once, at its root, in Ark UI's `LocaleProvider` with the app's locale (`<LocaleProvider locale="ar-EG">`, from `@ark-ui/react/locale`, `@ark-ui/vue/locale` or `@ark-ui/svelte/locale`). The layout follows `dir`; the keyboard follows the provider, and without it the arrow keys stay left-to-right. Components take no `dir` prop.

## 3. Add components

```bash
npx fndn add button select dialog
```

Each component gets a folder of its own in the ui folder: `button/` holds `index.ts` (what app code imports), the adapter (`button.tsx`; Vue: `Button.vue`; Svelte: `Button.svelte`), `button.recipe.ts` (every class of every part) and, when it has some, the logic its adapter needs. Everything those files import comes with them: the components they are built from, and `lib/`, what several components share (`tv.ts`, tailwind-variants set up for the token classes; the shared recipes `control.ts`, `popup.ts` and `option.ts`; the helpers `modality.ts`, `truncate.ts`, `glide.ts` and `paint.ts`). The command ends with the one install line for the npm packages those files need (tailwind-variants, Ark UI, Phosphor).

A component is imported from its folder, the same way in every framework. The files are yours to edit. One you have changed is never overwritten.

**React**

`src/App.tsx`

```tsx
import { Button } from "@/components/ui/button";

export default function App() {
  return <Button variant="primary">Save changes</Button>;
}
```

**Vue**

`src/App.vue`

```vue
<script setup lang="ts">
import { Button } from "@/components/ui/button";
</script>

<template>
  <Button variant="primary">Save changes</Button>
</template>
```

**Svelte**

`src/routes/+page.svelte`

```svelte
<script lang="ts">
  import { Button } from "$lib/components/ui/button";
</script>

<Button variant="primary">Save changes</Button>
```

## 4. Find and read

```bash
npx fndn search "pick a date"
npx fndn docs date-picker
npx fndn docs design
```

`search` lists the components that answer a need (all of them without a query). `docs <name>` prints a component's contract (parts, props, keyboard, motion) and its examples in the project's framework. `docs` also takes a topic: `design`, `motion`, `interaction`, `accessibility`, `authoring` (how to build a new component the way the system builds its own), `porting` (a component in another framework), `rules`, `tokens`, `icons`.

## 5. Check

```bash
npx fndn check
```

Reads the project's source and reports what breaks the system's rules: a Tailwind palette colour or a literal colour where a token belongs; Tailwind's own `transition-*`, durations, easings and animations where the motion utilities belong; Tailwind's radius and shadow scales; a physical side (`ml-`, `pr-`, `left-`, `border-l`, `rounded-tr`, `text-left`) where the logical one (`ms-`, `pe-`, `start-`, `border-s`, `rounded-se`, `text-start`) keeps right-to-left working; an icon-only button without a name; in hand-written CSS, a hover that is not gated to a real pointer or a literal duration. Run it before a piece of UI is called done. The library's own source passes the same check, so a project that passes is built to the same standard.

## 6. Keep up to date

```bash
npx fndn status
npx fndn update
npx fndn remove select
```

`status` lists the files you have changed and the ones the library has improved since. `update` rewrites the files that are still the library's and leaves yours alone. `remove` deletes a component and whatever only it needed; a component that another one is built from, or that a component of your own imports, stays, and so does a file you have changed.

## For agents: the MCP server

The same package speaks the Model Context Protocol over stdio, with the tools `search`, `docs`, `add`, `check`, `status` and `init`. Register it with the agent's MCP configuration (for Claude Code, `.mcp.json` in the project):

```json
{
  "mcpServers": {
    "fndn": {
      "command": "npx",
      "args": [
        "-y",
        "fndn",
        "mcp"
      ]
    }
  }
}
```
