---
title: Installation
description: How to setup, install and run next-forge.
---

## Initialization

Run the `next-forge` init command, replacing `[my-app]` with your project name.

```sh Terminal
npx next-forge@latest init [my-app]
```

You can also specify the package manager to use with the `package-manager` option, e.g.

```sh Terminal
npx next-forge@latest init [my-app] --package-manager bun
```

This will create a new directory with your project name and clone the repo into it. It will run a setup script to install dependencies and copy `.env` files. You can read more about environment variables [here](/setup/env).

## Database

You will need to scaffold the database using the schema defined in `packages/database/prisma/schema.prisma`:

```sh Terminal
pnpm migrate
```

## CMS

You will need to setup the CMS. Follow the instructions [here](/features/cms), but the summary is:

1. Fork the [`basehub/next-forge`](https://basehub.com/basehub/next-forge?fork=1) template
2. Get your Read Token from the "Connect to Your App" page
3. Add the `BASEHUB_TOKEN` to your [Environment Variables](/features/env)

## Development

Run the development server with:

```sh Terminal
pnpm dev
```

Open the localhost URLs with the relevant ports listed above to see the app, e.g.

- [http://localhost:3000/](http://localhost:3000/) — The main app.
- [http://localhost:3001/](http://localhost:3001/) — The website.
- [http://localhost:3002/](http://localhost:3002/) — The API.
- [http://localhost:3003/](http://localhost:3003/) — Email preview server.
- [http://localhost:3004/](http://localhost:3004/) — The docs
