# 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

The Node.js version depends on your edition. It is the `engines` field in that edition's `package.json`.

| Edition | Node.js                                                                  |
| ------- | ------------------------------------------------------------------------ |
| Astro   | 22.12.0 or later                                                         |
| Tina    | 22 (22.22.0 or later) or 24. Tina's command line tool supports only those two |
| Sanity  | 22.23.4 or later                                                         |

The theme uses modern Astro 7 and Tailwind CSS 4 tooling, so use a version from this table.

<Tabs>
  <TabItem label="Windows">

    Follow these steps to install Node.js on Windows:

    1. Download the latest suitable **LTS/current 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.
    3. After installation, open the **Command Prompt** and verify the installation:

    ```bash
    node -v
    ```

    You should see a version number that matches the table above.

    <Aside type="tip">
      If you run into any issues, you can use **Chocolatey** to install Node.js:

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

  </TabItem>

  <TabItem label="macOS">

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

    1. Make sure [Homebrew](https://brew.sh/) is installed.
    2. Open **Terminal** and run:

    ```bash
    brew install node
    ```

    3. Verify the installation:

    ```bash
    node -v
    ```

    The terminal should display the installed version of Node.js.

    <Aside type="tip">
      You can also download the installer directly from [Node.js Downloads](https://nodejs.org/en/download/) if you prefer not to use Homebrew.
    </Aside>

  </TabItem>

  <TabItem label="Linux">

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

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

    ```bash
    sudo apt update
    ```

    2. Install Node.js:

    ```bash
    sudo apt install nodejs npm
    ```

    3. Verify the installation:

    ```bash
    node -v
    ```

    If everything worked correctly, the installed version will be displayed. Your package manager may give you an older version than the table above asks for. If it does, use the official guide below.

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

  </TabItem>
</Tabs>

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

---

### **Setting Up Techbyte**

Once Node.js is installed, follow these steps to set up Techbyte. The theme uses **npm**, which comes with Node.js.

#### Install Dependencies

Navigate to your **project directory** (the theme's folder inside `themes/`, the one with `package.json`) and run:

```bash
npm ci
```

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

#### Start the Development Server

To start the local development server, run:

```bash
npm run dev
```

This generates the settings file from `src/config/config.toml`, watches `config.toml` for changes, and starts the site at **http://localhost:4321**.

What happens next depends on your edition:

- **Astro:** edit the files in your code editor. To use another port, run `npm run dev -- --port 4322`.
- **Tina:** `npm run dev` also starts the editor. Open **http://localhost:4321/admin/** and click **Enter Edit Mode**. You need no account and no password. To use another port, set `PORT` in `.env`. See [Tina](../../features/tina/).
- **Sanity:** the site runs with the bundled demo content, with no account. To edit it, run `npm run setup` to connect your own Sanity project, then `npm run dev:all`, and open the Studio at **http://localhost:3333**. To use another port, set `SITE_PORT` in `.env`. See [Sanity](../../features/sanity/).

<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, run:

```bash
npm run build
```

This regenerates the settings file, runs the Astro build, strips draft pages from the sitemap, and inlines critical CSS, placing the final output in the `dist/` folder.

#### Preview the Production Build

To preview the built site locally, run:

```bash
npm run preview
```

This builds the site and serves `dist/` on your computer, so you can check it before deployment.

#### Check Your Changes

Run this after you change code or content schemas:

```bash
npm run astro-check
```

---

🚀 **You're all set.** Next, review the project structure so you know where Techbyte keeps its content, layouts, and configuration.