Docs Features

cpk server

The codepakt server is a local HTTP daemon that runs in the background. It holds all project state in SQLite and serves both the REST API (used by cpk) and the dashboard UI.

cpk server start

Starts the server as a background daemon.

cpk server start
Starting Codepakt server...
Server running on :41920 (PID: 34821)
  Version:  0.1.1

The process forks and detaches — your terminal returns immediately. The server continues running after you close the terminal.

Options:

FlagDefaultDescription
--port <number>41920Port to listen on. Equivalent to setting CPK_PORT.
--data <path>~/.codepaktDirectory for database, PID file, and logs.
cpk server start --port 8080 --data /var/codepakt

Files created on start:

FileDescription
~/.codepakt/data.dbSQLite database in WAL mode
~/.codepakt/server.pidPID of the running server process
~/.codepakt/server.logServer access and error logs

If a server is already running on the target port, start exits immediately:

Server already running on :41920 (PID: 34821)

cpk server stop

Gracefully stops the running server.

cpk server stop
Server stopped.

If no server is running:

Server is not running.

cpk server status

Checks whether the server is running and on which port.

cpk server status
Server running on :41920 (PID: 34821)
  Version: 0.1.1
  Uptime:  8042s

If the server is not running:

Server is not running.

status checks both the PID file and performs a live HTTP health check against the server. If the PID file exists but the process is not responding:

Server process running (PID: 34821) but not responding on :41920.

cpk server logs

Shows server log output.

cpk server logs

Prints the last 50 lines of ~/.codepakt/server.log by default.

Options:

FlagDefaultDescription
-f, --followoffStream new log entries in real time (like tail -f). Press Ctrl+C to stop.
-n, --lines <n>50Number of recent lines to show.
# Follow logs in real time
cpk server logs -f

# Show last 200 lines
cpk server logs -n 200

Log entries include HTTP access logs and any startup errors. The log file grows unbounded in v0.1 — rotate manually if running long-term.

The log file lives at ~/.codepakt/server.log (or <data-dir>/server.log if you used --data on start).

Port conflicts

If port 41920 is in use by another process:

cpk server start --port 9000

You must also update your project config to point at the new port:

cpk config set url http://localhost:9000

Or use the CPK_PORT environment variable consistently across all sessions:

export CPK_PORT=9000
cpk server start