Installation & Setup
Prerequisites
- Node.js 20 or later --- CSP Analyser uses modern Node.js APIs (
node:util parseArgs, top-level await in ESM) that require v20+. - A Chromium-compatible browser is installed automatically by the
setupcommand (see below).
Install
Global install (recommended)
Install once and use csp-analyser from any directory:
npm install -g @makerx/csp-analyserLocal install as a dev dependency
If you prefer to pin the version per-project:
npm install -D @makerx/csp-analyserThen run via npx:
npx @makerx/csp-analyser crawl https://example.comRun setup
After installing, run the setup command to download Chromium and any OS-level dependencies Playwright needs:
csp-analyser setupThis calls npx playwright install --with-deps chromium under the hood. It only needs to run once per machine (or after a major Playwright version bump).
TIP
If you already have Playwright browsers installed from another project, setup will detect and reuse them.
Platform-specific notes
# setup handles this automatically, but if you need to install
# Playwright dependencies manually:
npx playwright install-deps chromium# Install the system dependencies Playwright needs:
sudo pacman -S --needed nss alsa-lib atk at-spi2-core cups \
libdrm libxcomposite libxdamage libxrandr mesa pango
# Alternatively, install playwright-chromium from the AUR:
# yay -S playwright-chromium# No extra dependencies required. setup handles everything.
csp-analyser setup# Run from PowerShell or CMD. No extra dependencies required.
csp-analyser setupData directory
CSP Analyser stores its SQLite database and session data in a platform-appropriate directory:
| Platform | Location |
|---|---|
| Linux | $XDG_CONFIG_HOME/csp-analyser (defaults to ~/.config/csp-analyser) |
| macOS | ~/Library/Application Support/csp-analyser |
| Windows | %LOCALAPPDATA%\csp-analyser |
csp-analyser/
data.db # SQLite database (sessions, violations, policies)The directory is created automatically on first run.
Verify the installation
csp-analyser --versionYou should see the installed version number (e.g. 0.1.0). If you installed locally, use npx @makerx/csp-analyser --version.
Next steps
Head to the Quick Start guide to generate your first CSP policy in under five minutes.