# Development Setup

> This page explains how to set up a local development environment for contributing to or customizing the Aegis theme.

## Prerequisites

Ensure the following tools are installed on your machine:

| Tool | Minimum Version | Purpose |
| --- | --- | --- |
| Node.js | 20.18 or later (`.nvmrc` pins 22) | JavaScript build tools |
| npm | 10 or later | Package management |
| PHP | 8.1 or later | Theme runtime and testing |
| Composer | 2 or later | PHP dependency management |
| Git | Any recent version | Version control |
| Docker | Latest | WordPress local environment (wp-env) |

### Checking Installed Versions

```
node --version      # Should output v20.x or laternpm --version       # Should output 9.x or laterphp --version       # Should output 8.1.x or latercomposer --version  # Should output 2.xgit --version       # Any recent versiondocker --version    # Latest stable
```

## Get the Source

Place the Aegis source in `wp-content/themes/aegis`, then open that folder:

```
cd wp-content/themes/aegis
```

## Install Dependencies

### PHP Dependencies

```
composer install
```

This installs all PHP packages into the `vendor/` directory, including:

- PSR-4 autoloader configuration.
- Development tools (PHPUnit, PHPCS).
- Any required libraries.

### Node.js Dependencies

```
npm install
```

This installs all JavaScript packages into the `node_modules/` directory, including:

- `@wordpress/scripts` — Build toolchain.
- ESLint and stylelint — Code quality tools.
- Testing utilities.

### Node Version Management

The repository includes an `.nvmrc` file. If you use nvm:

```
nvm use
```

This switches to the correct Node.js version automatically.

## Local WordPress Environment

Aegis uses `wp-env` (powered by Docker) for local development. This provides a complete WordPress installation with zero manual configuration.

### Starting the Environment

```
npm run env:start
```

Or directly:

```
npm run env:start
```

This starts:

- WordPress on **http://localhost:8888**
- WordPress admin at **http://localhost:8888/wp-admin/**
- MySQL database on port 3306 (internal to Docker)

### Default Credentials

| Field | Value |
| --- | --- |
| Admin URL | http://localhost:8888/wp-admin/ |
| Username | `admin` |
| Password | `password` |

### Stopping the Environment

```
npm run env:stop
```

Or:

```
npx wp-env stop
```

### Resetting the Environment

To start fresh with a clean WordPress installation:

```
npx wp-env clean all
```

### Environment Configuration

The `.wp-env.json` file configures the local environment:

```
{    "core": null,    "phpVersion": "8.1",    "plugins": [],    "themes": ["."],    "port": 8888,    "config": {        "WP_DEBUG": true,        "WP_DEBUG_LOG": true,        "SCRIPT_DEBUG": true    }}
```

## Building Assets

After installing dependencies, build the theme assets:

```
npm run build
```

For development with file watching:

```
npm run dev
```

See [Building Assets](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/building-assets/) for detailed build documentation.

## Directory Structure

After setup, your workspace should look like:

```
aegis/├── .wp-env.json          # wp-env configuration├── composer.json         # PHP dependencies├── package.json          # Node.js dependencies├── node_modules/         # Installed Node packages├── vendor/               # Installed PHP packages├── assets/               # Source files│   ├── css/              # Source stylesheets│   └── js/              # Source JavaScript├── src/                  # Theme glue + block sources (compiled in place)├── parts/                # Template parts├── patterns/             # Block patterns├── styles/               # Style variations├── templates/            # Page templates└── theme.json            # Theme configuration
```

## Development Workflow

A typical development session:

1. **Start the environment:** `npm run env:start`
2. **Start the theme watcher:** `npm run dev` (in `wp-content/themes/aegis`)
3. **Plugin changes:** run `npm run dev` or `npm run build` in `wp-content/plugins/aegis-dash` when editing map/modal/admin assets
4. **Open the site:** http://localhost:8888
5. **Make changes** to source files.
6. **View changes** in the browser (auto-refreshed by the watcher).
7. **Run tests** before committing: `npm run test`
8. **Commit changes** using conventional commit messages.

## IDE Configuration

### VS Code

Recommended extensions:

- PHP Intelephense — PHP language support.
- ESLint — JavaScript linting.
- Stylelint — CSS linting.
- WordPress Snippets — WordPress function completion.
- EditorConfig — Consistent formatting.

### PhpStorm

- Configure the PHP interpreter to use 8.1+.
- Set the WordPress source as an include path for autocompletion.
- Configure PHPCS with the WordPress coding standards.

## Aegis plugins (Optional)

To develop with the full Aegis ecosystem:

Place Aegis Dash source in `wp-content/plugins/aegis-dash` and, if you have access, the Pro source in `wp-content/plugins/aegis-pro`.

Then add them to `.wp-env.json`:

```
{    "plugins": [        "../../../plugins/aegis",        "../../../plugins/aegis-pro"    ]}
```

## Troubleshooting

### Docker Not Running

Ensure Docker Desktop is running before starting wp-env.

### Port 8888 Already in Use

Stop any other service using port 8888, or change the port in `.wp-env.json`.

### Permission Issues

On Linux/macOS, you may need to run Docker commands with appropriate permissions.

### Node.js Version Mismatch

Use `nvm use` to switch to the correct version specified in `.nvmrc`.

## Next Steps

- [Building Assets](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/building-assets/) — Learn about the build process.
- [Code Quality](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/code-quality/) — Set up linting and formatting.
- [Testing](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/testing/) — Run the test suite.
- [Contributing](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/contributing/) — Contribution guidelines.

---

Source: https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/development-setup/ · Updated 2026-11-24
