# Installation

## Installation Guide

Follow these steps to set up and start using the theme.

### **Prerequisites**

Before you begin, ensure your system meets the following requirements.

<Aside type="tip">
  If you're on **macOS**, the easiest way to install dependencies is using
  [Homebrew](https://docs.brew.sh/Installation). Homebrew is a package manager
  that simplifies installing software. Follow [this
  guide](https://mac.install.guide/homebrew/index.html) to install Homebrew.
</Aside>

### Install Node.js

Looka requires **Node.js 22.12.0 or later** to work, in all three editions. The Tina edition is more specific: its command line tool supports only Node.js 22 (22.12.0 or later) and 24. Node.js lets you run JavaScript code on your computer. Here's how to install it based on your operating system:

<Tabs>
  <TabItem label="Windows">

    Follow these steps to install Node.js on Windows:

    1. Download the latest **LTS version** of Node.js from the official website: [Node.js Downloads](https://nodejs.org/en/download/)
    2. Run the installer after it's downloaded, and follow the on-screen instructions. The installer will guide you through the process.
    3. After installation, open the **Command Prompt** (search for "cmd" in the Start menu) and verify the installation by typing the following command and pressing Enter:

    ```bash
    node -v
    ```

    If Node.js was installed correctly, you’ll see the version number (e.g., v22.13.1). This confirms that Node.js is ready to use!

    <Aside type="tip">
      If you run into any issues, you can use **Chocolatey** (a Windows package manager) to install Node.js. Open the **Command Prompt** and run:

      ```bash
      choco install nodejs-lts
      ```
    </Aside>

  </TabItem>

  <TabItem label="macOS">

    Here's how to install Node.js on macOS:

    1. First, make sure you have [Homebrew](https://brew.sh/) installed. Homebrew is a tool that makes installing software easy. If you don't have it, follow [this guide](https://mac.install.guide/homebrew/index.html) to install it.
    2. Open your **Terminal** (you can find it in Applications > Utilities) and run this command to install Node.js:

    ```bash
    brew install node
    ```

    3. After installation, verify Node.js by typing the following command:

    ```bash
    node -v
    ```

    If everything is set up, the terminal will display the installed version of Node.js.

    <Aside type="tip">
      If you prefer, you can also download the installer directly from the official [Node.js Downloads](https://nodejs.org/en/download/) page instead of using Homebrew.
    </Aside>

  </TabItem>

  <TabItem label="Linux">

    To install Node.js on Linux, follow these steps:

    1. Open your **Terminal** and update your package list:

    ```bash
    sudo apt update
    ```

    2. Install Node.js using your package manager:

    ```bash
    sudo apt install nodejs
    ```

    3. Optionally, install npm (Node.js package manager) by running:

    ```bash
    sudo apt install npm
    ```

    4. Verify the installation by typing:

    ```bash
    node -v
    ```

    The installed version of Node.js will be displayed if everything worked correctly.

    <Aside type="tip">
      For other Linux distributions, check the [official Node.js installation guide](https://nodejs.org/en/download/package-manager/) for additional instructions.
    </Aside>

  </TabItem>
</Tabs>

Run `node -v` when you finish. If it shows a version older than 22.12.0, install a newer one from [Node.js Downloads](https://nodejs.org/en/download/). Some Linux package lists have an older version. In the Tina edition, the version must be 22 or 24, and the newest Node.js release can be above that.

💡 **Need help?** Check out the official [Node.js installation guide](https://nodejs.org/en/download).

---

### **Setting Up Looka**

Once Node.js is installed, unzip the theme and open a terminal in its folder. These steps work in every [edition](../../features/editions/):

#### Install Dependencies

Navigate to your **project directory** (the main theme folder) and run:

```bash
npm ci
```

This will install the exact dependency versions from `package-lock.json`.

#### Start the Development Server

To start the local development server and view your site on your computer, run:

```bash
npm run dev
```

🔹 Your site will be available at **http://localhost:4321**.

`npm run dev` also turns `src/config/config.toml` into the settings file the theme reads, and watches it for changes. To use another port on the Astro edition, run `npm run dev -- --port 4322`.

<Aside type="note">
  `npm run dev` starts the `config.toml` watcher and the site together. We have
  not tested it on Windows. If the site doesn't start there, press
  <kbd>Ctrl</kbd> + <kbd>C</kbd> and run the two parts in two terminals: `npm run toml:watch -- --watch`
  in the first, `npx astro dev` in the second.
</Aside>

#### Create a Production Build

To generate an optimized production build of your site, run the following command in your project root:

```bash
npm run build
```

This will compile your project, optimize assets, make the sitemap, and prepare everything for deployment. The output will be located in the `dist/` folder.

#### Preview the Production Build

To see how your site will look in the final production version, run:

```bash
npm run preview
```

This builds the site, then serves `dist/` on your computer, so you can see how the theme will look once it's live on the internet.

Run `npm run astro-check` after you change code or content schemas.

#### Tina Edition

Keep `npm run dev` running and open **http://localhost:4321/admin/**. Click **Enter Edit Mode**. You need no account and no password. See [Tina](../../features/tina/).

#### Sanity Edition

`npm run dev` shows the bundled demo content, with no account. To edit it, connect your own Sanity project:

```bash
npm run setup
npm run dev:all
```

Then open the Studio at **http://localhost:3333**. See [Sanity](../../features/sanity/).

---

🚀 **You're all set!** Now you can start customizing Looka to fit your needs. 🎨