> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/calcom/cal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Development Setup

> Get your local development environment up and running

## Prerequisites

Before you begin, ensure you have the following installed:

* **Node.js** (Version: >=18.x)
* **PostgreSQL** (Version: >=13.x)
* **Yarn** (>=4.12.0) - recommended package manager
* **Git** for version control

<Info>
  If you want to enable any of the available integrations, you may need additional credentials. See the [Integrations section](https://cal.com/docs) for more details.
</Info>

## Quick Start with Docker

The fastest way to get started is using Docker:

```bash theme={null}
yarn dx
```

<Note>
  **Requirements:**

  * Docker and Docker Compose must be installed
  * This will start a local Postgres instance with test users
</Note>

### Default Test Credentials

| Email                    | Password          | Role                  |
| ------------------------ | ----------------- | --------------------- |
| `free@example.com`       | `free`            | Free user             |
| `pro@example.com`        | `pro`             | Pro user              |
| `trial@example.com`      | `trial`           | Trial user            |
| `admin@example.com`      | `ADMINadmin2022!` | Admin user            |
| `onboarding@example.com` | `onboarding`      | Onboarding incomplete |

Access the application at [http://localhost:3000](http://localhost:3000)

<Tip>
  To view all seeded users and their details, run `yarn db-studio` and visit [http://localhost:5555](http://localhost:5555)
</Tip>

## Manual Setup

### 1. Clone the Repository

Clone the repository (or [fork it](https://github.com/calcom/cal.com/fork)):

```bash theme={null}
git clone https://github.com/calcom/cal.com.git
cd cal.com
```

<Warning>
  **Windows Users:** Run this command in `gitbash` with admin privileges:

  ```bash theme={null}
  git clone -c core.symlinks=true https://github.com/calcom/cal.com.git
  ```

  See [docs](https://cal.com/docs/how-to-guides/how-to-troubleshoot-symbolic-link-issues-on-windows#enable-symbolic-links) for symbolic link troubleshooting.
</Warning>

### 2. Install Dependencies

```bash theme={null}
yarn
```

### 3. Configure Environment Variables

Duplicate the example file:

```bash theme={null}
cp .env.example .env
```

Generate required secrets:

```bash theme={null}
# Generate NEXTAUTH_SECRET
openssl rand -base64 32

# Generate CALENDSO_ENCRYPTION_KEY
openssl rand -base64 24
```

Add these values to your `.env` file.

<Warning>
  **Windows Users:** Replace the `packages/prisma/.env` symlink with a real copy to avoid Prisma errors:

  ```bash theme={null}
  rm packages/prisma/.env && cp .env packages/prisma/.env
  ```
</Warning>

### 4. Set Up Node Version

Use the correct Node version with nvm:

```bash theme={null}
nvm use
```

If the version isn't installed:

```bash theme={null}
nvm install && nvm use
```

### 5. Configure Database

Set the `DATABASE_URL` in your `.env` file:

```bash theme={null}
DATABASE_URL='postgresql://<user>:<pass>@<db-host>:<db-port>/<db-name>'
```

#### Option A: Local PostgreSQL

1. [Download and install PostgreSQL](https://www.postgresql.org/download/)
2. Create a database:
   ```bash theme={null}
   createdb calcom
   ```
3. Connect and verify:
   ```bash theme={null}
   psql -h localhost -U postgres -d calcom
   \conninfo
   ```

#### Option B: Cloud Services

Alternatively, use a hosted database:

* [Railway.app](https://docs.railway.app/guides/postgresql)
* [Northflank](https://northflank.com/guides/deploy-postgres-database-on-northflank)
* [Render](https://render.com/docs/databases)

### 6. Copy Database URL to App Store Config

```bash theme={null}
cp .env .env.appStore
```

Or manually copy the `DATABASE_URL` from `.env` to `.env.appStore`.

### 7. Run Database Migrations

**Development:**

```bash theme={null}
yarn workspace @calcom/prisma db-migrate
```

**Production:**

```bash theme={null}
yarn workspace @calcom/prisma db-deploy
```

### 8. Set Up MailHog (Optional)

For viewing emails during development:

```bash theme={null}
docker pull mailhog/mailhog
docker run -d -p 8025:8025 -p 1025:1025 mailhog/mailhog
```

<Note>
  Required when `E2E_TEST_MAILHOG_ENABLED` is set to "1"
</Note>

### 9. Start Development Server

```bash theme={null}
yarn dev
```

The application will be available at [http://localhost:3000](http://localhost:3000)

## Creating Your First User

### Method 1: Using Prisma Studio

1. Open Prisma Studio:
   ```bash theme={null}
   yarn db-studio
   ```

2. Navigate to the `User` model

3. Add a new record with:
   * `email`
   * `username`
   * `password` (encrypted with [BCrypt](https://bcrypt-generator.com/))
   * `metadata` set to `{}`

4. Access [http://localhost:3000](http://localhost:3000) and login

### Method 2: Seed the Database

```bash theme={null}
cd packages/prisma
yarn db-seed
```

This populates the database with dummy users (same as `yarn dx`).

## Development Tips

### Increase Node Memory

Add to your shell profile or run before starting the app:

```bash theme={null}
export NODE_OPTIONS="--max-old-space-size=16384"
```

### Control Logging Verbosity

Set the log level in your `.env` file:

```bash theme={null}
NEXT_PUBLIC_LOGGER_LEVEL=3  # info level
```

**Log Levels:**

* `0` - silly
* `1` - trace
* `2` - debug
* `3` - info
* `4` - warn
* `5` - error
* `6` - fatal

## Gitpod Setup

Click the button below to open a fully configured workspace:

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/calcom/cal.com)

## Updating Your Local Environment

1. Pull the latest changes:
   ```bash theme={null}
   git pull
   ```

2. Update dependencies:
   ```bash theme={null}
   yarn
   ```

3. Run migrations:
   ```bash theme={null}
   yarn workspace @calcom/prisma db-migrate  # Development
   yarn workspace @calcom/prisma db-deploy   # Production
   ```

4. Check for environment variable changes:
   ```bash theme={null}
   yarn predev
   ```

5. Restart the development server:
   ```bash theme={null}
   yarn dev
   ```

## Building for Production

Ensure you can create a full production build:

```bash theme={null}
yarn build
```

<Warning>
  Always verify that a production build succeeds before pushing code.
</Warning>

## Next Steps

* Review the [Architecture](/developers/contributing/architecture) to understand the codebase structure
* Read the [Coding Guidelines](/developers/contributing/guidelines) before making changes
* Learn about [Testing](/developers/contributing/testing) practices
