> For the complete documentation index, see [llms.txt](https://affine.gitbook.io/affine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://affine.gitbook.io/affine/developer-docs/setup.md).

# Setup

## Pre-requisites

Before you follow the rest of this guide you'll want to make sure you have installed [Node.js](https://nodejs.org/) (>=16) and [pnpm](https://pnpm.io/) (>7.x). You'll also need Git setup to pull our source code from GitHub.

We also recommend using an IDE, such as [VSCode](https://code.visualstudio.com/), and the nx console plugin is recommended for creating dependencies.

## Installation

Clone our GitHub

```
git clone https://github.com/toeverything/AFFiNE.git
```

Currently we have two versions of AFFiNE:

* [AFFiNE Alpha](https://pathfinder.affine.pro/). This version uses the `master` branch, this is the latest version under active development. We plan to update this to the master branch in the near future.
* [AFFiNE Pre-Alpha](https://livedemo.affine.pro/). This version uses the branch `pre-alpha`, however is no longer actively developed and has been effectively archived.

Select the master branch

```
cd AFFiNE
```

Install dependencies

```
pnpm install
```

Start AFFiNE

```
pnpm dev
```

Default settings will run AFFiNE on localhost, port 3000 - <http://localhost:3000>

## Further Steps

The `.env.local` file can be found in the project folder. You can add the following variable to enable the development environment.

```
NODE_ENV=development
```

For git-cz functionality, please install the corresponding dependencies globally.

```
npm install -g commitizen conventional-changelog conventional-changelog-cli
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://affine.gitbook.io/affine/developer-docs/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
