Conduct

Installation

Overview

Conduct consists of two main components:

  1. Backend - Self-hosted service (Node.js + Database)
  2. CLI - Client tool for interacting with the backend

Backend Installation

Requirements

  • Node.js 18+
  • Docker and Docker Compose
  • One of: PostgreSQL, MySQL, or SQLite

Clone the repository and use Docker Compose:

git clone https://github.com/21nOrg/conduct.git
cd conduct/backend
 
# Start all services (backend + postgres)
docker-compose up -d

The backend will be available at http://localhost:3000.

Option 2: Manual Setup

Install dependencies:

cd backend
pnpm install

Start a PostgreSQL instance:

docker-compose up -d postgres

Configure environment:

cp .env.example .env

Edit .env with your database credentials:

DATABASE_URL=postgresql://conduct:conduct@localhost:5432/conduct

Run migrations:

npm run db:setup

Start the server:

tsx example-server.ts

Database Options

docker run -d \
  --name postgres \
  -e POSTGRES_USER=conduct \
  -e POSTGRES_PASSWORD=conduct \
  -e POSTGRES_DB=conduct \
  -p 5432:5432 \
  postgres:16

MySQL

docker run -d \
  --name mysql \
  -e MYSQL_ROOT_PASSWORD=conduct \
  -e MYSQL_DATABASE=conduct \
  -p 3306:3306 \
  mysql:8

Update DATABASE_URL in .env:

DATABASE_URL=mysql://root:conduct@localhost:3306/conduct

SQLite (Development Only)

DATABASE_URL=file:./conduct.db

Verify Backend

Check the health endpoint:

curl http://localhost:3000/health

You should see:

{
  "status": "healthy",
  "timestamp": "2025-12-08T..."
}

CLI Installation

Global Installation

Install globally for system-wide use:

npm install -g conduct-cli@0.2.0

Verify:

conduct --version

Local Installation

Install as a dev dependency in your project:

npm install --save-dev conduct-cli@0.2.0

Use with npx:

npx conduct --version

Or add to package.json scripts:

{
  "scripts": {
    "conduct": "conduct"
  }
}

Then run:

npm run conduct -- --version

From Source

Clone and build from source:

git clone https://github.com/21nOrg/conduct.git
cd conduct/cli
pnpm install
pnpm build
 
# Link globally
npm link

Post-Installation

1. Create API Key

When you first start the backend, it generates an admin API key:

tsx example-server.ts

Save the output:

Admin API Key: sk_admin_xxxxxxxxxxxxx

Or create additional keys via API:

curl -X POST http://localhost:3000/conduct/v1/auth/keys \
  -H "Authorization: Bearer sk_admin_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "dev-key",
    "permissions": ["read", "write"]
  }'

2. Configure CLI Profile

Add your backend profile:

conduct profile add \
  --name local \
  --url http://localhost:3000/conduct \
  --key sk_admin_xxxxxxxxxxxxx \
  --project myproject

Set as active:

conduct profile use local

Test connection:

conduct profile test

3. Initialize Project

In your project directory:

conduct init

This creates:

_conduct/
├── specs/
├── runs/
├── checks/
└── features/

Upgrading

Backend

Pull latest changes and rebuild:

git pull origin main
cd backend
pnpm install
npm run db:migrate
docker-compose up -d --build

CLI

Update to the latest version:

npm update -g conduct-cli

Or for local installation:

npm update conduct-cli

Uninstalling

Backend

Stop and remove containers:

docker-compose down -v

Remove data (optional):

docker volume rm backend_postgres_data

CLI

Remove global installation:

npm uninstall -g conduct-cli

Remove local installation:

npm uninstall conduct-cli

Next Steps