Skip to content
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3a79286
feat: add commands
ogzhanolguncu Jul 14, 2025
30531e7
feat: allow configuring name,desc and version
ogzhanolguncu Jul 14, 2025
53e33f9
feat: pass env to cli
ogzhanolguncu Jul 14, 2025
cc55b1d
feat: match the initial impl
ogzhanolguncu Jul 14, 2025
82d3393
feat: add new progress aniamtion
ogzhanolguncu Jul 14, 2025
d05bce4
feat: add tracker step for each phase
ogzhanolguncu Jul 14, 2025
9e1b02a
refactor: improve animations and errors
ogzhanolguncu Jul 15, 2025
aa7cde2
feat: use proper orchestrafor managing steps and trackers
ogzhanolguncu Jul 15, 2025
454828e
refactor: rename build to run
ogzhanolguncu Jul 15, 2025
f058067
refactor: remove UI logic from api
ogzhanolguncu Jul 15, 2025
7e1a3b4
chore: remove redundant commands
ogzhanolguncu Jul 15, 2025
238c658
refactor: remove ui bloat
ogzhanolguncu Jul 15, 2025
e8ab3dc
feat: add colors for make it distinguishable
ogzhanolguncu Jul 15, 2025
2cd7fa4
Merge branch 'main' into ENG-1903
ogzhanolguncu Jul 15, 2025
9152767
fix: steps
ogzhanolguncu Jul 15, 2025
52fe00d
fix: code rabbit issues
ogzhanolguncu Jul 15, 2025
f80dd82
feat: add proper flag parsing logic
ogzhanolguncu Jul 16, 2025
496a994
refactor: show help if required args are missing
ogzhanolguncu Jul 16, 2025
b8f964f
feat: add missing commands
ogzhanolguncu Jul 16, 2025
1f5b476
fix: code rabbit comments
ogzhanolguncu Jul 16, 2025
74f407a
refactor: fix redundancy
ogzhanolguncu Jul 16, 2025
2a8f0ed
Merge branch 'main' into ENG-1903
ogzhanolguncu Jul 16, 2025
c93dfdd
feat: add config generation
ogzhanolguncu Jul 16, 2025
ecbe3f2
chore: fmt
ogzhanolguncu Jul 16, 2025
5a83cce
Merge branch 'main' of github.com:unkeyed/unkey into add-config-gener…
ogzhanolguncu Jul 17, 2025
d6e0edd
fix: change final output of success
ogzhanolguncu Jul 17, 2025
550d22f
feat: replace old cli with new cli
ogzhanolguncu Jul 17, 2025
9f90f23
Merge branch 'main' of github.com:unkeyed/unkey into add-config-gener…
ogzhanolguncu Jul 21, 2025
2040a9a
fix: ui order
ogzhanolguncu Jul 21, 2025
11510ce
fix: docker errors
ogzhanolguncu Jul 21, 2025
4b2ed82
refactor: improve error handling
ogzhanolguncu Jul 21, 2025
2e450ef
refactor: move constants to top
ogzhanolguncu Jul 21, 2025
1e9f186
refactor: add some delay to version poll
ogzhanolguncu Jul 21, 2025
7f73b9c
refactor: replace old cli with new one
ogzhanolguncu Jul 21, 2025
395fb5f
fix: code rabit issues
ogzhanolguncu Jul 21, 2025
6ef87a2
fix: coderabbit issue
ogzhanolguncu Jul 21, 2025
2796519
docs: explain artificial delay
chronark Jul 22, 2025
86f0c40
fix: PR comments
ogzhanolguncu Jul 22, 2025
117d081
Merge branch 'add-config-generation-to-cli' of github.com:unkeyed/unk…
ogzhanolguncu Jul 22, 2025
b17db16
fix: coderabbit comment
ogzhanolguncu Jul 22, 2025
dedb385
fix: use hardcoded strings for temp docker build
ogzhanolguncu Jul 22, 2025
399f4e5
feat: generate docs from cli
ogzhanolguncu Jul 22, 2025
24d070f
feat: also call sub commands when generating
ogzhanolguncu Jul 22, 2025
94247ae
Merge branch 'main' of github.com:unkeyed/unkey into generate-docs-fr…
ogzhanolguncu Jul 23, 2025
65dec03
refactor: improve mdxs
ogzhanolguncu Jul 23, 2025
2e29e62
fix: sub command generation
ogzhanolguncu Jul 23, 2025
797092b
chore: test generated files
ogzhanolguncu Jul 24, 2025
a693277
chore: trigger build
ogzhanolguncu Jul 24, 2025
9b27bd4
chore: trigger build
ogzhanolguncu Jul 24, 2025
39c3960
chore: trigger test
ogzhanolguncu Jul 24, 2025
8657647
chore: trigger another one
ogzhanolguncu Jul 24, 2025
85ca42a
chore: triggering.
ogzhanolguncu Jul 24, 2025
cefbf68
chore: generate cli commands docs
ogzhanolguncu Jul 24, 2025
586fe95
Merge branch 'main' into generate-docs-from-cli
ogzhanolguncu Jul 24, 2025
d2a182a
fix: remove unused code
ogzhanolguncu Jul 24, 2025
8ab6269
refactor: errors
ogzhanolguncu Jul 24, 2025
ff4dfe7
refactor: add example comments
ogzhanolguncu Jul 24, 2025
d16d202
refactor: add more descriptive comments
ogzhanolguncu Jul 24, 2025
f2ace8c
refactor: use compiled regex table
ogzhanolguncu Jul 24, 2025
b0a7cb3
fix: get rid of enVars
ogzhanolguncu Jul 24, 2025
b178f77
fix: get rid of special mdx escapes
ogzhanolguncu Jul 25, 2025
531b456
fix: descriptions
ogzhanolguncu Jul 25, 2025
4653fba
chore: replace generated docs
ogzhanolguncu Jul 25, 2025
1682029
Merge branch 'main' into generate-docs-from-cli
ogzhanolguncu Jul 25, 2025
caa6742
Update index.mdx
chronark Jul 28, 2025
7bf50d0
docs: move cli to its own section
chronark Jul 28, 2025
5860eea
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 28, 2025
f05805d
refactor: improve table look
ogzhanolguncu Jul 28, 2025
cebfeaf
refactor: update quick referrence
ogzhanolguncu Jul 28, 2025
a72993e
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 28, 2025
7c3e569
Merge branch 'main' into generate-docs-from-cli
ogzhanolguncu Jul 28, 2025
f36af39
fix: build
ogzhanolguncu Jul 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/engineering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ pnpm dev
yarn dev
```

Open http://localhost:3000 with your browser to see the result.
Open <http://localhost:3000> with your browser to see the result.

## Learn More

To learn more about Next.js and Fumadocs, take a look at the following
resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js.
features and API.
Comment thread
ogzhanolguncu marked this conversation as resolved.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs
2 changes: 1 addition & 1 deletion apps/engineering/content/docs/architecture/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"description": "How does Unkey work",
"icon": "Pencil",
"root": false,
"pages": ["index", "---Services---"]
"pages": ["index", "services"]
}
107 changes: 107 additions & 0 deletions apps/engineering/content/docs/architecture/services/deploy/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: "Deploy Command"
description: "Deploy a new version or initialize configuration"
---
Build and deploy a new version of your application, or initialize configuration.

The deploy command handles the complete deployment lifecycle: from building Docker images to deploying them on Unkey's infrastructure. It automatically detects your Git context, builds containers, and manages the deployment process with real-time status updates.

## Initialization Mode

Use --init to create a configuration template file. This generates an unkey.json file with your project settings, making future deployments simpler and more consistent across environments.

## Deployment Process

1. Load configuration from unkey.json or flags
2. Build Docker image from your application
3. Push image to container registry
4. Create deployment version on Unkey platform
5. Monitor deployment status until active

## Command Syntax

```bash
deploy [flags]
```

## Examples

### Initialize new project configuration

```bash
unkey deploy --init
```

### Initialize with custom location

```bash
unkey deploy --init --config=./my-project
```

### Force overwrite existing configuration

```bash
unkey deploy --init --force
```

### Standard deployment (uses ./unkey.json)

```bash
unkey deploy
```

### Deploy from specific config directory

```bash
unkey deploy --config=./production
```

### Override workspace from config file

```bash
unkey deploy --workspace-id=ws_production_123
```

### Deploy with custom build context

```bash
unkey deploy --context=./api
```

### Local development (build only, no push)

```bash
unkey deploy --skip-push
```

### Deploy pre-built image

```bash
unkey deploy --docker-image=ghcr.io/user/app:v1.0.0
```

### Verbose output for debugging

```bash
unkey deploy --verbose
```

## Flags

| Flag | Description | Type | Default | Environment |
| --- | --- | --- | --- | --- |
| `--config` | Directory containing unkey.json config file | string |- |- |
| `--init` | Initialize configuration file in the specified directory | boolean |`false` |- |
| `--force` | Force overwrite existing configuration file when using --init | boolean |`false` |- |
| `--workspace-id` | Workspace ID | string |- |`UNKEY_WORKSPACE_ID` |
| `--project-id` | Project ID | string |- |`UNKEY_PROJECT_ID` |
| `--context` | Build context path | string |- |- |
| `--branch` | Git branch | string |`"main"` |- |
| `--docker-image` | Pre-built docker image | string |- |- |
| `--dockerfile` | Path to Dockerfile | string |`"Dockerfile"` |- |
| `--commit` | Git commit SHA | string |- |- |
| `--registry` | Container registry | string |`"ghcr.io/unkeyed/deploy"` |`UNKEY_REGISTRY` |
| `--skip-push` | Skip pushing to registry (for local testing) | boolean |`false` |- |
| `--verbose` | Show detailed output for build and deployment operations | boolean |`false` |- |
| `--control-plane-url` | Control plane URL | string |`"http://localhost:7091"` |- |
| `--auth-token` | Control plane auth token | string |`"ctrl-secret-token"` |- |
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "Healthcheck Command"
description: "Perform an HTTP healthcheck against a given URL"
---
This command sends an HTTP GET request to the specified URL and validates the response. It exits with code 0 if the server returns a 200 status code, otherwise exits with code 1.

## Use Cases

This is useful for health monitoring in CI/CD pipelines, service availability checks, load balancer health probes, and infrastructure monitoring scripts.

Comment thread
ogzhanolguncu marked this conversation as resolved.
## Command Syntax

```bash
unkey healthcheck [flags]
```
Comment thread
chronark marked this conversation as resolved.
Comment thread
ogzhanolguncu marked this conversation as resolved.

## Examples

### Check if a service is healthy

```bash
unkey healthcheck https://api.unkey.dev/health
```

### Check local service

```bash
unkey healthcheck http://localhost:8080/health
```

### Use in monitoring script

```bash
unkey healthcheck https://example.com/api/status || echo 'Service is down!'
```
12 changes: 11 additions & 1 deletion apps/engineering/content/docs/architecture/services/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@
"title": "Services",
"icon": "Pencil",
"root": false,
"pages": ["vault", "clickhouse", "clickhouse-proxy"]
"pages": [
"api",
"clickhouse",
"clickhouse-proxy",
"deploy",
"healthcheck",
"quotacheck",
"run",
"vault",
"version"
]
Comment thread
ogzhanolguncu marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "Quotacheck Command"
description: "Check for exceeded quotas"
---
Check for exceeded quotas and optionally send Slack notifications.

This command monitors quota usage by querying ClickHouse for current usage metrics and comparing them against configured limits in the primary database. When quotas are exceeded, it can automatically send notifications via Slack webhook.

## Configuration

The command requires ClickHouse and database connections to function. Slack notifications are optional but recommended for production monitoring.

## Command Syntax

```bash
quotacheck [flags]
```

## Examples

### Check quotas without notifications

```bash
unkey quotacheck --clickhouse-url clickhouse://localhost:9000 --database-dsn postgres://user:pass@localhost/db
```

### Check quotas with Slack notifications

```bash
unkey quotacheck --clickhouse-url clickhouse://localhost:9000 --database-dsn postgres://user:pass@localhost/db --slack-webhook-url https://hooks.slack.com/services/...
```

### Using environment variables

```bash
CLICKHOUSE_URL=... DATABASE_DSN=... SLACK_WEBHOOK_URL=... unkey quotacheck
```

## Flags

| Flag | Description | Type | Default | Environment |
| --- | --- | --- | --- | --- |
| `--clickhouse-url` **(required)** | URL for the ClickHouse database | string |- |`CLICKHOUSE_URL` |
| `--database-dsn` **(required)** | DSN for the primary database | string |- |`DATABASE_DSN` |
| `--slack-webhook-url` | Slack webhook URL to send notifications | string |- |`SLACK_WEBHOOK_URL` |
Comment thread
ogzhanolguncu marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "Run Api Command"
description: "Run the Unkey API server for validating and managing API keys"
---
Run the Unkey API server for validating and managing API keys

## Command Syntax

```bash
api [flags]
```

## Flags

| Flag | Description | Type | Default | Environment |
| --- | --- | --- | --- | --- |
| `--http-port` | HTTP port for the API server to listen on. Default: 7070 | integer |`7070` |`UNKEY_HTTP_PORT` |
| `--color` | Enable colored log output. Default: true | boolean |`true` |`UNKEY_LOGS_COLOR` |
| `--test-mode` | Enable test mode. WARNING: Potentially unsafe, may trust client inputs blindly. Default: false | boolean |`false` |`UNKEY_TEST_MODE` |
| `--platform` | Cloud platform identifier for this node. Used for logging and metrics. | string |- |`UNKEY_PLATFORM` |
| `--image` | Container image identifier. Used for logging and metrics. | string |- |`UNKEY_IMAGE` |
| `--region` | Geographic region identifier. Used for logging and routing. Default: unknown | string |`"unknown"` |`AWS_REGION` |
| `--instance-id` | Unique identifier for this instance. Auto-generated if not provided. | string |`"ins_6gi44j"` |`UNKEY_INSTANCE_ID` |
| `--database-primary` **(required)** | MySQL connection string for primary database. Required for all deployments. Example: user:pass@host:3306/unkey?parseTime=true | string |- |`UNKEY_DATABASE_PRIMARY` |
| `--database-replica` | MySQL connection string for read-replica. Reduces load on primary database. Format same as database-primary. | string |- |`UNKEY_DATABASE_REPLICA` |
| `--redis-url` | Redis connection string for rate-limiting and distributed counters. Example: redis://localhost:6379 | string |- |`UNKEY_REDIS_URL` |
| `--clickhouse-url` | ClickHouse connection string for analytics. Recommended for production. Example: clickhouse://user:pass@host:9000/unkey | string |- |`UNKEY_CLICKHOUSE_URL` |
| `--otel` | Enable OpenTelemetry tracing and metrics | boolean |`false` |`UNKEY_OTEL` |
| `--otel-trace-sampling-rate` | Sampling rate for OpenTelemetry traces (0.0-1.0). Only used when --otel is provided. Default: 0.25 | float |`0.25` |`UNKEY_OTEL_TRACE_SAMPLING_RATE` |
| `--prometheus-port` | Enable Prometheus /metrics endpoint on specified port. Set to 0 to disable. | integer |- |`UNKEY_PROMETHEUS_PORT` |
| `--tls-cert-file` | Path to TLS certificate file for HTTPS. Both cert and key must be provided to enable HTTPS. | string |- |`UNKEY_TLS_CERT_FILE` |
| `--tls-key-file` | Path to TLS key file for HTTPS. Both cert and key must be provided to enable HTTPS. | string |- |`UNKEY_TLS_KEY_FILE` |
| `--vault-master-keys` | Vault master keys for encryption | string[] |- |`UNKEY_VAULT_MASTER_KEYS` |
| `--vault-s3-url` | S3 Compatible Endpoint URL | string |- |`UNKEY_VAULT_S3_URL` |
| `--vault-s3-bucket` | S3 bucket name | string |- |`UNKEY_VAULT_S3_BUCKET` |
| `--vault-s3-access-key-id` | S3 access key ID | string |- |`UNKEY_VAULT_S3_ACCESS_KEY_ID` |
| `--vault-s3-secret-access-key` | S3 secret access key | string |- |`UNKEY_VAULT_S3_SECRET_ACCESS_KEY` |
| `--chproxy-enabled` | Enable ClickHouse proxy endpoints for high-throughput event collection | boolean |`false` |`UNKEY_CHPROXY_ENABLED` |
| `--chproxy-auth-token` | Authentication token for ClickHouse proxy endpoints. Required when proxy is enabled. | string |- |`UNKEY_CHPROXY_AUTH_TOKEN` |
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "Run Ctrl Command"
description: "Run the Unkey control plane service for managing infrastructure and services"
---
Run the Unkey control plane service for managing infrastructure and services

## Command Syntax

```bash
ctrl [flags]
```

## Flags

| Flag | Description | Type | Default | Environment |
| --- | --- | --- | --- | --- |
| `--http-port` | HTTP port for the control plane server to listen on. Default: 8080 | integer |`8080` |`UNKEY_HTTP_PORT` |
| `--color` | Enable colored log output. Default: true | boolean |`true` |`UNKEY_LOGS_COLOR` |
| `--platform` | Cloud platform identifier for this node. Used for logging and metrics. | string |- |`UNKEY_PLATFORM` |
| `--image` | Container image identifier. Used for logging and metrics. | string |- |`UNKEY_IMAGE` |
| `--region` | Geographic region identifier. Used for logging and routing. Default: unknown | string |`"unknown"` |`AWS_REGION` |
| `--instance-id` | Unique identifier for this instance. Auto-generated if not provided. | string |`"ins_WZy92"` |`UNKEY_INSTANCE_ID` |
| `--database-primary` **(required)** | MySQL connection string for primary database. Required for all deployments. Example: user:pass@host:3306/unkey?parseTime=true | string |- |`UNKEY_DATABASE_PRIMARY` |
| `--database-hydra` **(required)** | MySQL connection string for hydra database. Required for all deployments. Example: user:pass@host:3306/hydra?parseTime=true | string |- |`UNKEY_DATABASE_HYDRA` |
| `--otel` | Enable OpenTelemetry tracing and metrics | boolean |`false` |`UNKEY_OTEL` |
| `--otel-trace-sampling-rate` | Sampling rate for OpenTelemetry traces (0.0-1.0). Only used when --otel is provided. Default: 0.25 | float |`0.25` |`UNKEY_OTEL_TRACE_SAMPLING_RATE` |
| `--tls-cert-file` | Path to TLS certificate file for HTTPS. Both cert and key must be provided to enable HTTPS. | string |- |`UNKEY_TLS_CERT_FILE` |
| `--tls-key-file` | Path to TLS key file for HTTPS. Both cert and key must be provided to enable HTTPS. | string |- |`UNKEY_TLS_KEY_FILE` |
| `--auth-token` | Authentication token for control plane API access. Required for secure deployments. | string |- |`UNKEY_AUTH_TOKEN` |
| `--metald-address` **(required)** | Full URL of the metald service for VM operations. Required for deployments. Example: https://metald.example.com:8080 | string |- |`UNKEY_METALD_ADDRESS` |
| `--spiffe-socket-path` | Path to SPIFFE agent socket for mTLS authentication. Default: /var/lib/spire/agent/agent.sock | string |`"/var/lib/spire/agent/agent.sock"` |`UNKEY_SPIFFE_SOCKET_PATH` |
16 changes: 16 additions & 0 deletions apps/engineering/content/docs/architecture/services/run/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Run Command"
description: "Run Unkey services"
---
Run various Unkey services in development or production environments.

This command starts different Unkey microservices. Each service can be configured independently and runs as a standalone process.

## Available Services

- api: The main API server for validating and managing API keys
- ctrl: The control plane service for managing infrastructure and deployments

## Quick Reference
- `run api` - Run the Unkey API server for validating and managing API keys
- `run ctrl` - Run the Unkey control plane service for managing infrastructure and services
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "Version Get Command"
description: "Get details about a version"
---
Get comprehensive details about a specific version including status, branch, creation time, and associated hostnames.

## Command Syntax

```bash
get [flags]
```

## Examples

### Get details for a specific version

```bash
unkey version get v_abc123def456
```

### Get details for another version

```bash
unkey version get v_def456ghi789
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Version Command"
description: "Manage API versions"
---
Create, list, and manage versions of your API.

Versions are immutable snapshots of your code, configuration, and infrastructure settings. Each version represents a specific deployment state that can be rolled back to at any time.

## Available Commands

- get: Get details about a specific version
- list: List all versions with optional filtering
- rollback: Rollback to a previous version

## Quick Reference
- `version get` - Get details about a version
- `version list` - List versions with optional filtering
- `version rollback` - Rollback to a previous version
Loading
Loading