> 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/getting-started/deploy-affine-to-vercel.md).

# Deploy AFFiNE to Vercel

[Vercel](https://vercel.com) is a platform for frontend developers, providing the speed and reliability innovators need to create at the moment of inspiration.

`AFFiNE` can be simply deployed to `Vercel` with just a few mouse clicks because `Vercel` fully supports `Next.js`, which is the stack used by `AFFiNE`.

Before we begin, we'll assume you already have a `Vercel` account and have connected it to your `GitHub` account.

1. Fork [AFFiNE](https://github.com/toeverything/AFFiNE) to your own `GitHub` account.
2. After logging in to [Vercel](https://vercel.com), go to your hobby page and click the `Add New... - Project` button.
3. Click the `Import` button after selecting the AFFINE repository you forked (if you cannot access your repository, go to the Vercel team's [guide](https://vercel.com/docs/concepts/git#deploying-a-git-repository)).
4. Next, configure your project as follows:

   * Build Command - `AFFiNE` uses pnpm to build whole app
   * Output Directory - output of build assets in the app folder
   * Install Command - since we set up `AFFiNE` as a `Next.js` project, `Vercel` will detect `Next.js` dependencies, but the work dir is the root dir, so this is required as `Vercel` will otherwise not find `Next.js` dependencies

   <figure><img src="https://github.com/toeverything/AFFiNE-docs/assets/5910926/ad9599c0-5a35-47d3-8f91-9eb431120c10" alt="image" width="967"><figcaption></figcaption></figure>

1\. To deploy \`AFFiNE\` to a production environment, click \`Deploy\`. 1. After building is complete, go to the address that \`Vercel\` provides and enjoy!

## Troubleshooting

If your building fails, go to the project settings page and verify whether your `Root Directory` is accurate.

Sometimes building fails when the `Root Directory` is set to `./` during the initialization of the project.

<figure><img src="https://github.com/toeverything/AFFiNE-docs/assets/5910926/ea78d3fb-f042-4150-8b51-6f2448f95df4" alt="image" width="967"><figcaption></figcaption></figure>

You can simply leave it empty or set it up using `./` as suggested in the tips.


---

# 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/getting-started/deploy-affine-to-vercel.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.
