# Installation

> Add Kiln to a Node or Cloudflare Workers project.

Install Kiln from npm:

```sh
npm install @lucidkiln/core
```

Kiln needs Node 24 or later, or Cloudflare Workers. It is an ES module and includes its own TypeScript types. Template files use the `.kiln` extension.

## Node

On Node, use `fileLoader` to read templates from a folder. It comes from a separate entry point, `@lucidkiln/core/node`, so it never ends up in a Workers bundle.

```ts
import { createKiln } from "@lucidkiln/core";
import { fileLoader } from "@lucidkiln/core/node";

const kiln = createKiln({
	loader: fileLoader({ root: "templates" }),
});
```

## Cloudflare Workers

Workers can't read files, so pass the templates in as strings with `memoryLoader`. How you collect them depends on your build. Most bundlers can import a file as text.

```ts
import { createKiln, memoryLoader } from "@lucidkiln/core";
import layout from "./templates/layouts/base.kiln?raw";
import home from "./templates/pages/home.kiln?raw";

const kiln = createKiln({
	loader: memoryLoader({
		"layouts/base.kiln": layout,
		"pages/home.kiln": home,
	}),
});
```

You can also write your own loader to fetch templates from a database or key-value store. See [Loaders](https://kilnlang.com/docs/api/loaders/).
