> ## Documentation Index
> Fetch the complete documentation index at: https://docs.napsterify.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Mac

> How to set up Napsterify on a Mac machine

## Prerequisites

* Ensure you are using **Node v22.12.0**

* Install [pnpm](https://pnpm.io/)

<Tip>
  Use `nvm` (Node Version Manager) to easily install and manage the required Node.js version as defined in the `.nvmrc`
  file.
</Tip>

## Setting Up JioSaavn

### Prerequisites

* Ensure you are using **Bun**.

### Step 1: Clone the Project

Run the following command to clone the repository and navigate into the project directory:

```bash
git clone https://www.github.com/shahil-yadav/saavn && cd saavn
```

### Step 2: Install Dependencies

Install the necessary dependencies using:

```bash
bun install
```

### Step 3: Run the server

```bash
bun dev
```

Once the server starts, you should see output similar to this:

```bash
$ bun run --hot src/server.ts
Started development server: http://localhost:3000
```

## Setup Turborepo (NextJS + Reddit)

### Step 1: Clone the Project

```bash
git clone https://www.github.com/shahil-yadav/napsterify && cd napsterify
```

### Step 2: Install Dependencies

Run the following commands:

```bash
nvm install && nvm use
pnpm install
```

### Step 3 \[**Optional**]: Install Turbo CLI Globally

```bash
npm install -g turbo
```

### Step 4: Run Development Servers

Start the development servers using:

```bash
turbo dev
```

OR

```bash
pnpm dev
```

### Step 5: Set Up Environment Secrets

Generate a secure authentication secret:
Then, configure the `.env` file in `apps/www`:

```bash
AUTH_DEBUG=true
AUTH_SECRET=<openssl rand -hex 32>
AUTH_REDDIT_ID=<your_reddit_id>
AUTH_REDDIT_SECRET=<your_reddit_secret>
```

<Tip>
  Confused about this `AUTH_REDDIT_ID` and `AUTH_REDDIT_SECRET`, wait see this while creating your own oauth application
  on Reddit

  <img src="https://mintlify.s3.us-west-1.amazonaws.com/napsterify/images/reddit.png" style={{ borderRadius: "0.5rem" }} />
</Tip>

### Step 6: Set the Gemini API Key or you can use Ollama locally

In the **`.dev.vars`** file under the AI worker `apps/fns/ai` directory, add:

```bash
# OPTIONAL IF YOU ARE USING OLLAMA
API_TOKEN=<gemini_token>
```

OR

```js src/routes/query.ts
const ai = new AI({ comment, provider: "ollama" })

// Ollama is configured to use `deepseek-r1:14b` model,
// however you can change it, if you want in the src/classes/ai.ts file
const results = await ai.generate()
```

<Tip>
  Cloudflare loads environment variables from the `.dev.vars` file.
</Tip>

### Step 7: Set the YouTube API Key

In the **`.dev.vars`** file under the YouTube worker `apps/fns/yt` directory, add:

```bash
API_TOKEN=<yt_token>
```

### Step 8: Start the Development Server

Run the dev server using:

```bash
turbo dev
```

OR

```bash
pnpm dev
```

### Additional Turbo CLI Features

<Tip>
  Instead of running all development servers at once, you can selectively start specific services:
</Tip>

```bash
turbo run dev --filter=@shahilyadav/www --filter=@shahilyadav/reddit
```

For more details, check out the [Turbo CLI documentation](https://turbo.build/repo/docs/reference#commands).
