---
title: "Installation"
description: "Add @qino/cms to a project and create a first collection."
canonical: "https://www.qino.works/docs/guide/installation"
---

# Installation

> Add @qino/cms to a project and create a first collection.

## Requirements

- Node.js 22 or newer, on the server. See [Runtime](#runtime).
- TypeScript is optional. If you use it, 5.9 or newer with `strict: true`.
- A [Standard Schema](https://standardschema.dev) validator. The examples use Zod.

## Install

```sh
npm install @qino/cms zod
```

Zod is only an example. Any [Standard Schema validator](https://standardschema.dev/schema#what-schema-libraries-implement-the-spec) works.

## Install with an agent

To let a coding agent do the setup, install the `set-up-qino-cms` skill, then ask your agent to add qino to the project:

```sh
npx skills add CharlyMartin/qino --skill set-up-qino-cms
```

The agent follows the steps on this page. It installs the package, models the content you already have as collections, trees, and items, infers the schemas, wires `qino build` into your build, and keeps going until it passes. It asks before moving or rewriting any of your files.

[View the skill on skills.sh](https://www.skills.sh/charlymartin/qino/set-up-qino-cms)

## Create the instance

The CLI expects a `qino/` folder at the project root with an `index.ts` that default-exports an `initQino` instance:

```ts title="qino/index.ts"
import { initQino } from "@qino/cms";

export default initQino({
  contentFolder: "src/content",
  mediaFolder: "public",
});
```

Both paths are relative to the working directory and must exist.

## Define a collection

```ts title="qino/collections/posts.ts"
import { z } from "zod";

import qino from "../";

export const postCollection = qino.defineCollection({
  directory: "posts",
  extension: ".md",
  schema: z.object({
    title: z.string(),
  }),
});
```

The frontmatter of every file in `src/content/posts/*.md` is validated against the schema. qino then adds the body as `markdown`, and `_meta` with the slug and file path.

## Read content

```ts title="src/app/posts/page.tsx"
const posts = await postCollection.getEntries();
const post = await postCollection.getEntry("hello-world");

post.title; // string
post.markdown; // string
post._meta.slug; // "hello-world"
```

## Validate on build

Add `qino build` as a `prebuild` step so lint, content validation, and type generation run before the app builds:

```json title="package.json"
{
  "scripts": {
    "prebuild": "qino build",
    "build": "next build"
  }
}
```

`qino build` writes `qino/_generated/types.d.ts`. Add that folder to `.gitignore`.

## Runtime

qino reads content from the file system with Node.js APIs, so getters only run in server code: build scripts, prerendering, React Server Components, route loaders, server functions, and API routes. They never run in the browser, so don't import definitions from `qino/` into client components. Edge runtimes without a file system, such as Cloudflare Workers or Vercel Edge Functions, are not supported.

Prerendered pages read content at build time and need nothing at runtime. Pages rendered on request read it from the deployed server, so the content folder must exist in that server's working directory. Platforms that bundle only the files your code imports can leave it out:

- **Next.js**: list the folder in `outputFileTracingIncludes` in `next.config.ts`.
- **Nitro** (TanStack Start, Nuxt): copy the folder into the server output after compilation.

```ts title="vite.config.ts"
import { cp } from "node:fs/promises";
import { join } from "node:path";

nitro({
  modules: [
    (nitro) => {
      nitro.hooks.hook("compiled", () =>
        cp(
          join(nitro.options.rootDir, "src/content"),
          join(nitro.options.output.serverDir, "src/content"),
          { recursive: true },
        ),
      );
    },
  ],
});
```

[Image fields](https://www.qino.works/docs/concepts/media#image-fields) need neither `mediaFolder` nor sharp's native binary on that server. `qino build` records each image in `.qino/images.json` inside the content folder, which ships with it.
