Prerequisites
Let's set up your machine to start building your first Document Model. Don't worry if this is your first time setting up a development environment - we'll guide you through each step!
If you've already set up Git, Node, and pnpm, your most important step is to install the Powerhouse CLI with the command: pnpm install ph-cmd
. A global install is recommended if you want to use the command from any directory as a power user. In this case use pnpm install -g ph-cmd
. The Powerhouse CLI is used to create, build, and run your Document Models and gives you direct access to a series of Powerhouse Builder Tools. Move to the end of this page to verify your installation.
Overview
Before we begin building our Document Model, we need to install some software on your machine. We'll need three main tools:
- Node.js 22, which helps us run our code.
- Visual Studio Code (VS Code), which is where we'll write our code
- Git, which helps us manage our code.
Follow the steps below based on your computer's operating system.
Installing node.js 22
node.js 22 is a tool that lets us run our application. Let's install it step by step.
For Windows:
-
Set up PowerShell for running commands:
- Press the Windows key
- Type "PowerShell"
- Right-click on "Windows PowerShell" and select "Run as administrator"
- In the PowerShell window, type this command and press Enter:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Type 'A' when prompted to confirm
- You can now close this window and open PowerShell normally for the remaining steps
-
Install node.js 22:
- Visit the node.js 22 official website
- Click the big green button that says "LTS" (this means Long Term Support - it's the most stable version)
- Once the installer downloads, double-click it to start installation
- Click "Next" through the installation wizard, leaving all settings at their defaults
-
Install pnpm:
- Open PowerShell (no need for admin mode)
- Type this command and press Enter:
npm install -g pnpm
-
Verify Installation:
- Open PowerShell (no need for admin mode)
- Type these commands one at a time and press Enter after each:
node --version
pnpm --version- You should see version numbers appear after each command (e.g., v18.17.0). If you do, congratulations - Node.js and pnpm are installed!
Note: If node.js 22 commands don't work in VS Code, restart VS Code to refresh environment variables.
For macOS:
-
Install Homebrew:
- Open Terminal (press Command + Space and type "Terminal")
- Copy and paste this command into Terminal and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Follow any additional instructions that appear
-
Install node.js 22:
- In the same Terminal window, type this command and press Enter:
brew install node@22
- Then, install pnpm:
brew install pnpm
-
Verify Installation:
- In Terminal, type these commands one at a time and press Enter after each:
node --version
pnpm --version- If you see version numbers, you've successfully installed Node.js and pnpm!
For Linux (Ubuntu/Debian):
-
Open Terminal:
- Press Ctrl + Alt + T on your keyboard, or
- Click the Activities button and type "Terminal"
-
Update Package List:
sudo apt update
-
Install node.js 22 and pnpm:
sudo apt install nodejs pnpm
-
Verify Installation:
- Type these commands one at a time and press Enter after each:
node --version
pnpm --version- If you see version numbers, you're all set!
Installing Visual Studio Code
VS Code is the editor we'll use to write our code. Here's how to install it:
For Windows:
- Visit the Visual Studio Code website
- Click the blue "Download for Windows" button
- Once the installer downloads, double-click it
- Accept the license agreement and click "Next"
- Leave the default installation location and click "Next"
- In the Select Additional Tasks window, make sure "Add to PATH" is checked
- Click "Next" and then "Install"
- When installation is complete, click "Finish"
For macOS:
- Visit the Visual Studio Code website
- Click the blue "Download for Mac" button
- Once the .zip file downloads, double-click it to extract
- Drag Visual Studio Code.app to the Applications folder
- Double-click the app to launch it
- To make VS Code available in your terminal:
- Open VS Code
- Press Command + Shift + P
- Type "shell command" and select "Shell Command: Install 'code' command in PATH"
For Linux (Ubuntu/Debian):
- Open Terminal (Ctrl + Alt + T)
- First, update the packages list:
sudo apt update
- Install the dependencies needed to add Microsoft's repository:
sudo apt install software-properties-common apt-transport-https wget
- Import Microsoft's GPG key:
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
- Add the VS Code repository:
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
- Install VS Code:
sudo apt install code
- Once installed, you can launch VS Code by:
- Typing
code
in the terminal, or - Finding it in your Applications menu
- Typing
Install Git
For Windows
- Open PowerShell (press Windows key, type "PowerShell", and press Enter)
- Visit the Git website
- Download the latest version for Windows
- Run the installer and use the recommended settings
- Verify installation by opening PowerShell:
git --version
For macOS
- Install using Homebrew:
brew install git
- Verify installation:
git --version
For Linux (Ubuntu/Debian)
- Update package list:
sudo apt update
- Install Git:
sudo apt install git
- Verify installation:
git --version
Configure Git (All Systems)
After installation, set up your identity:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Install the Powerhouse CLI
The Powerhouse CLI (installed via the ph-cmd
package) is a command-line interface tool. It provides the ph
command, which is essential for managing Powerhouse projects. You can get access to the Powerhouse Ecosystem tools by installing them globally using:
pnpm install -g ph-cmd
Key commands include:
ph connect
for running the Connect application locallyph switchboard
orph reactor
for starting the API serviceph init
to start a new project and build a document modelph help
to get an overview of all the available commands
This tool will be fundamental on your journey when creating, building, and running Document Models.
How to use different branches?
When installing or using the Powerhouse CLI commands you can use the dev & staging branches. These branches contain more experimental features than the latest stable release the PH CLI uses by default. They can be used to get access to a bug fix or features under development.
Command | Description |
---|---|
pnpm install -g ph-cmd | Install latest stable version |
pnpm install -g ph-cmd@dev | Install development version |
pnpm install -g ph-cmd@staging | Install staging version |
ph init | Use latest stable version of the boilerplate |
ph init --dev | Use development version of the boilerplate |
ph init --staging | Use staging version of the boilerplate |
ph use | Switch all dependencies to latest production versions |
ph use dev | Switch all dependencies to development versions |
ph use prod | Switch all dependencies to production versions |
Please be aware that these versions can contain bugs and experimental features that aren't fully tested.
Verify Installation
Open your terminal (command prompt) and run the following commands to verify your setup:
node --version
pnpm --version
git --version
ph --version
You should see version numbers displayed for all commands, similar to the example output below (your versions might be higher). The output for ph --version
includes its version and may also show additional messages if further setup like ph setup-globals
is needed.
You're now ready to start building your first Document Model!
% node --version
v22.16.0
% pnpm --version
10.10.0
% git --version
git version 2.39.3
% ph --version
PH CMD version: 0.43.18
-------------------------------------
PH CLI is not available, please run `ph setup-globals` to generate the default global project