Skip to content

Commit 1cb80fe

Browse files
committed
Add context and explanations to README
1 parent 173f41b commit 1cb80fe

1 file changed

Lines changed: 45 additions & 20 deletions

File tree

README.md

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,112 +35,137 @@ Common operations: `list` (`ls`), `get`, `create`, `delete` (`rm`)
3535

3636
## Workers
3737

38+
Workers are serverless functions deployed to the edge.
39+
3840
```bash
3941
ow workers list
4042
ow workers create my-api -d "REST API"
4143
ow workers get my-api
44+
45+
# Deploy a single file
4246
ow workers deploy my-api ./worker.ts -m "Initial deploy"
43-
ow workers upload my-app ./dist # Upload folder with assets
44-
ow workers link my-api --env my-env # Link environment
47+
48+
# Deploy a folder with worker.js + static assets (SvelteKit, etc.)
49+
ow workers upload my-app ./dist
50+
4551
ow workers delete my-api
4652
```
4753

4854
Supported file types: `.js`, `.ts`, `.wasm`
4955

5056
## Environments
5157

52-
Manage variables, secrets, and resource bindings.
58+
Environments group configuration for your workers: variables, secrets, and bindings to resources.
5359

5460
```bash
5561
ow env list
5662
ow env create my-env -d "Production"
5763
ow env get my-env
5864

59-
# Variables and secrets
65+
# Variables (plain text, visible in logs)
6066
ow env set my-env API_URL "https://api.example.com"
67+
68+
# Secrets (encrypted, masked in output)
6169
ow env set my-env API_KEY "secret" --secret
70+
6271
ow env unset my-env OLD_VAR
6372

64-
# Bind resources
73+
# Bindings connect resources to your worker code (accessible via env.CACHE, env.DB, etc.)
6574
ow env bind my-env CACHE my-kv --type kv
6675
ow env bind my-env DB my-db --type database
6776
ow env bind my-env ASSETS my-storage --type assets
6877

78+
# Link environment to a worker
79+
ow workers link my-api --env my-env
80+
6981
ow env delete old-env
7082
```
7183

7284
## Storage
7385

74-
S3-compatible storage (R2, MinIO, AWS S3).
86+
S3-compatible object storage for files, images, and static assets.
7587

7688
```bash
7789
ow storage list
90+
91+
# Platform-managed storage
7892
ow storage create my-storage
93+
94+
# Bring your own S3/R2 bucket
7995
ow storage create my-s3 --provider s3 \
8096
--bucket my-bucket \
8197
--endpoint https://xxx.r2.cloudflarestorage.com \
8298
--access-key-id AKIA... \
8399
--secret-access-key ...
100+
84101
ow storage delete my-storage
85102
```
86103

87104
## KV
88105

89-
Key-value namespaces for caching and sessions.
106+
Fast key-value store for caching, sessions, and feature flags.
90107

91108
```bash
92109
ow kv list
93-
ow kv create cache -d "API cache"
94-
ow kv get cache
95-
ow kv delete cache
110+
ow kv create my-kv -d "API cache"
111+
ow kv get my-kv
112+
ow kv delete my-kv
96113
```
97114

98115
## Databases
99116

100-
SQL database bindings.
117+
SQL databases for persistent data. Query with `env.DB.execute()` in your worker.
101118

102119
```bash
103120
ow databases list
121+
122+
# Platform-managed database
104123
ow databases create my-db
124+
125+
# Bring your own Postgres
105126
ow databases create my-pg --provider postgres \
106127
--connection-string "postgres://user:pass@host/db"
128+
107129
ow databases delete my-db
108130
```
109131

110132
## Aliases
111133

112-
The CLI supports multiple backends via aliases. Config is stored in `~/.openworkers/config.json`.
134+
Aliases let you manage multiple backends (production, staging, local) from the same CLI.
113135

114136
```bash
115-
# API backend (hosted or self-hosted)
137+
# API backend (hosted platform)
116138
ow alias set prod --api https://dash.openworkers.com
139+
140+
# API backend (self-hosted, skip TLS verification)
117141
ow alias set dev --api http://localhost:8080 --insecure
118142

119-
# DB backend (direct PostgreSQL, for migrations)
143+
# DB backend (direct PostgreSQL access for migrations)
120144
ow alias set local --db postgres://user:pass@localhost/ow --user admin@example.com
121145

122-
# Manage aliases
123146
ow alias list
124147
ow alias set-default prod
125148
ow alias rm old-alias
126149
```
127150

128-
Use an alias by prefixing commands:
151+
Prefix any command with an alias name:
129152

130153
```bash
131154
ow workers list # Uses default alias
132155
ow prod workers list # Uses 'prod' alias
133-
ow local migrate run # Uses 'local' alias
156+
ow dev workers get my-api # Uses 'dev' alias
134157
```
135158

159+
Config stored in `~/.openworkers/config.json`.
160+
136161
## Migrations
137162

138-
Database schema migrations (requires DB alias).
163+
Database schema migrations for self-hosted deployments. Requires a DB alias.
139164

140165
```bash
141166
ow local migrate status # Show pending migrations
142-
ow local migrate run # Apply migrations
143-
ow local migrate baseline # Mark all as applied (existing DB)
167+
ow local migrate run # Apply pending migrations
168+
ow local migrate baseline # Mark all as applied (for existing databases)
144169
```
145170

146171
## Config File

0 commit comments

Comments
 (0)