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.
Important: The server is only required for task coordination commands (cpk task *, cpk board *, cpk agent *, cpk docs *). Code intelligence commands (cpk scan, cpk code *) read/write the local SQLite file directly and work without the daemon.
cpk server start
Starts the server as a background daemon.
cpk server start
Starting Codepakt server...
Server running on :41920 (PID: 34821)
Version: 0.2.0
The process forks and detaches — your terminal returns immediately. The server continues running after you close the terminal.
Options:
| Flag | Default | Description |
|---|---|---|
--port <number> | 41920 | Port to listen on. Equivalent to setting CPK_PORT. |
--data <path> | ~/.codepakt | Directory for database, PID file, and logs. |
cpk server start --port 8080 --data /var/codepakt
Files created on start:
| File | Description |
|---|---|
~/.codepakt/data.db | SQLite database in WAL mode |
~/.codepakt/server.pid | PID of the running server process |
~/.codepakt/server.log | Server 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.2.0
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:
| Flag | Default | Description |
|---|---|---|
-f, --follow | off | Stream new log entries in real time (like tail -f). Press Ctrl+C to stop. |
-n, --lines <n> | 50 | Number 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
Related
- Installation — data directory structure