# Installation

## Installation Guide

**Skill level:** Beginner · **Time:** 10 minutes

You need two things on your computer: **Node.js** (the program that runs the theme) and a **code editor** to open the files. If you have never used a terminal before, read [Tools You Need](/covena/beginner/tools-setup/) first.

### Requirements
- **Node.js 22.12 or later** (the `engines` field in `package.json`)
- **npm**, which comes with Node.js. Covena ships a `package-lock.json`, so use npm rather than Yarn or pnpm
- A code editor. [VS Code](https://code.visualstudio.com/) is a good free choice. When you open the folder, it suggests the Astro, TOML, and Tailwind CSS extensions the theme recommends

### Install Node.js
<Tabs>
  <TabItem label="Windows">

    Download the **LTS** installer from [nodejs.org](https://nodejs.org/en/download/) and run it. Then open **PowerShell** and check the version:

    ```bash
    node -v
    ```

  </TabItem>
  <TabItem label="macOS">

    Download the installer from [nodejs.org](https://nodejs.org/en/download/), or use Homebrew:

    ```bash
    brew install node
    node -v
    ```

  </TabItem>
  <TabItem label="Linux">

    Install Node.js with your package manager or the official installer, then check the version:

    ```bash
    node -v
    ```

  </TabItem>
</Tabs>

The result must be `v22.12.0` or higher.

### Run Covena On Your Computer
<Steps>

1. Unzip the download and move the theme folder to wherever you keep your projects. Open it in your code editor. It is the folder that contains `package.json` and `AGENTS.md`.

2. Open a terminal **inside that folder**. In VS Code, use **Terminal → New Terminal**.

3. Install the dependencies (only needed once, and again after updates):

   ```bash
   npm ci
   ```

   `npm ci` installs the exact versions listed in `package-lock.json`. `npm install` works too.

4. Start the development server:

   ```bash
   npm run dev
   ```

5. Open [http://localhost:4321/](http://localhost:4321/) in your browser. You see Home 1. The other two homepages are at `/home-corporate/` and `/home-family/`, and the French and Arabic sites start at `/fr/` and `/ar/`.

</Steps>

`npm run dev` turns `src/config/config.toml` into `.astro/config.generated.json`, starts the site, and watches `config.toml` for changes. Never edit the generated file: your changes go in `config.toml`.

Leave the terminal running while you work. When you save a file, including `config.toml`, the browser updates on its own. Press <kbd>Ctrl</kbd> + <kbd>C</kbd> in the terminal to stop the server.

<Aside type="note" title="When to restart npm run dev">
  When you save `config.toml`, the terminal prints `[toml-watcher] ✓ Generated`
  and the page reloads. If the TOML has a syntax error, the terminal prints
  `[toml-watcher] ✖ Conversion failed` with the reason. Restart the server
  (<kbd>Ctrl</kbd> + <kbd>C</kbd>, then `npm run dev`) after you change
  languages, `[settings.multilingual]`, the site URL, or `trailingSlash`, and
  after you change `src/config/fonts.json`: Astro reads those only when it
  starts.
</Aside>

**Port 4321 already in use?** Add another port after `--`:

```bash
npm run dev -- --port 4322
```

### Build And Preview The Production Site
```bash
npm run build
npm run preview
```

`npm run build` writes the finished site to the `dist/` folder. `npm run preview` builds it again and serves it at [http://localhost:4321/](http://localhost:4321/), so you can test it as visitors will see it.

On a fresh copy, the build ends with a yellow `[site]` warning: the site URL is not set yet, so the sitemap is skipped and links in `llms.txt`, RSS, and social previews point at the build host. That is expected on your computer. Set `baseUrl` in `[site]` before you deploy ([Quick Start](/covena/getting-started/quick-start/), step 1).

The forms also run in demo mode until you connect them: they check the fields, then say nothing was sent. See [Forms](/covena/customization/forms/).

### Every Script, In Plain Words
| Command                                 | What it does                                                                                                                                                        |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `npm run dev`                           | Starts the local site with live reload, and converts `config.toml` each time you save it                                                                            |
| `npm run build`                         | Builds the production site into `dist/`. Warns while the site URL is not set                                                                                        |
| `npm run preview`                       | Builds, then serves the production site locally                                                                                                                     |
| `npm run astro-check`                   | Checks components and content files for type and schema mistakes. Run it after you change code or a content file's fields                                           |
| `npm run test`                          | Runs the theme's unit tests                                                                                                                                         |
| `npm run verify`                        | Runs every check: `astro-check`, the tests, formatting, the build, then the link, route, language, section, and hreflang checks on the built site. Run it before you deploy |
| `npm run format`                        | Tidies the formatting of files in `src/`                                                                                                                            |
| `npm run format:check`                  | Reports files in `src/` whose formatting `format` would change, without changing them                                                                               |
| `npm run generate-favicons`             | Creates every favicon size from `[site.favicon] image` in `config.toml`                                                                                             |
| `npm run generate-multilingual-content` | Adds a language: it copies your default language's content, menu, and labels. See [Internationalization](/covena/customization/internationalization/)              |
| `npm run remove-multilingual`           | Deletes the content of every language except your default one. Read [Internationalization](/covena/customization/internationalization/) first                      |
| `npm run deploy:cf`                     | Uploads `dist/` to Cloudflare Pages with Wrangler (see [Deployment](/covena/deployment/))                                                                           |
| `npm run toml:watch`                    | Turns `config.toml` into `.astro/config.generated.json`. `build`, `preview`, `astro-check`, and `test` already run it                                               |

<Aside type="tip">
  The theme also ships a GitHub Actions workflow (`.github/workflows/verify.yml`)
  that runs `npm ci` and `npm run verify` on every push to `main` and on pull
  requests, if you keep your site in a GitHub repository.
</Aside>

Next: [Quick Start](/covena/getting-started/quick-start/), to make the site yours in about 30 minutes.