@mediamonks/canopy-cli 0.7.10 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deploy-BKFICJT1.mjs → deploy-B1WrPq5W.mjs} +12 -2
- package/dist/{dev-DtoZrexp.mjs → dev-BnUYGQQm.mjs} +5 -4
- package/dist/dev-CySBxW7I.mjs +2 -0
- package/dist/{dev-worker-BZgtEM9V.mjs → dev-worker-IWnHvQ1f.mjs} +42 -7
- package/dist/{docs-Ck9xogEV.mjs → docs-DxB7NhZs.mjs} +1 -1
- package/dist/{feedback-BpiCvItH.mjs → feedback-B-GXUBPs.mjs} +1 -1
- package/dist/index.mjs +10 -10
- package/dist/{local-C5AhA4GM.mjs → local-BGRd_FMZ.mjs} +6 -469
- package/dist/{package-DRp7sI6i.mjs → package-CDLufecy.mjs} +1 -1
- package/dist/{skill-B2sDMAmv.mjs → skill-BOWfqwr2.mjs} +1 -1
- package/dist/src-Bu4Ze32I.mjs +470 -0
- package/dist/{upgrade-tOfSmAcc.mjs → upgrade-fhfrid_O.mjs} +1 -1
- package/package.json +3 -3
- package/dist/dev-BYxSHUH6.mjs +0 -2
- package/dist/docs/ci.md +0 -50
- package/dist/docs/cli-create.md +0 -46
- package/dist/docs/cli-db.md +0 -86
- package/dist/docs/cli-delete.md +0 -44
- package/dist/docs/cli-deploy.md +0 -58
- package/dist/docs/cli-dev.md +0 -82
- package/dist/docs/cli-docs.md +0 -47
- package/dist/docs/cli-download.md +0 -42
- package/dist/docs/cli-egress.md +0 -37
- package/dist/docs/cli-feedback.md +0 -75
- package/dist/docs/cli-index.md +0 -61
- package/dist/docs/cli-init.md +0 -46
- package/dist/docs/cli-login.md +0 -43
- package/dist/docs/cli-logout.md +0 -32
- package/dist/docs/cli-logs.md +0 -57
- package/dist/docs/cli-open.md +0 -41
- package/dist/docs/cli-projects.md +0 -43
- package/dist/docs/cli-promote.md +0 -44
- package/dist/docs/cli-rollback.md +0 -45
- package/dist/docs/cli-skill.md +0 -39
- package/dist/docs/cli-staging.md +0 -54
- package/dist/docs/cli-token.md +0 -47
- package/dist/docs/cli-upgrade.md +0 -43
- package/dist/docs/cli-usage.md +0 -43
- package/dist/docs/cli-whoami.md +0 -46
- package/dist/docs/cli.md +0 -86
- package/dist/docs/data.md +0 -85
- package/dist/docs/deploy.md +0 -81
- package/dist/docs/dev.md +0 -72
- package/dist/docs/developers-agents-and-ai.md +0 -95
- package/dist/docs/developers-architecture.md +0 -106
- package/dist/docs/getting-started.md +0 -108
- package/dist/docs/index.json +0 -331
- package/dist/docs/infrastructure.md +0 -406
- package/dist/docs/migrations.md +0 -183
- package/dist/docs/overview-faq.md +0 -105
- package/dist/docs/overview-how-it-works.md +0 -82
- package/dist/docs/overview-use-cases.md +0 -76
- package/dist/docs/overview-what-is-canopy.md +0 -75
- package/dist/docs/platform-ai-usage.md +0 -65
- package/dist/docs/platform-client-access.md +0 -54
- package/dist/docs/platform-deploys-and-rollbacks.md +0 -93
- package/dist/docs/platform-egress.md +0 -75
- package/dist/docs/platform-feedback.md +0 -114
- package/dist/docs/platform-members-and-access.md +0 -71
- package/dist/docs/platform-project-data.md +0 -76
- package/dist/docs/platform-schedules.md +0 -90
- package/dist/docs/platform-sites-and-profiles.md +0 -61
- package/dist/docs/porting-nextjs.md +0 -233
- package/dist/docs/sdk-ai.md +0 -103
- package/dist/docs/sdk-auth.md +0 -57
- package/dist/docs/sdk-database.md +0 -126
- package/dist/docs/sdk-files.md +0 -82
- package/dist/docs/sdk-services.md +0 -58
- package/dist/docs/sdk.md +0 -126
- package/dist/docs/staging.md +0 -106
- package/dist/docs/static-serving.md +0 -318
- package/dist/docs/troubleshooting.md +0 -102
- package/dist/skill/canopy/SKILL.md +0 -160
- package/dist/templates/spa/.github/workflows/canopy-deploy.yml +0 -34
- package/dist/templates/spa/AGENTS.md +0 -47
- package/dist/templates/spa/README.md +0 -14
- package/dist/templates/spa/_gitignore +0 -4
- package/dist/templates/spa/canopy.json +0 -5
- package/dist/templates/spa/index.html +0 -12
- package/dist/templates/spa/package.json +0 -21
- package/dist/templates/spa/src/app.tsx +0 -25
- package/dist/templates/spa/src/canopy.ts +0 -5
- package/dist/templates/spa/src/main.tsx +0 -10
- package/dist/templates/spa/src/style.css +0 -29
- package/dist/templates/spa/tsconfig.json +0 -16
- package/dist/templates/spa/vite.config.ts +0 -7
- package/dist/templates/static/AGENTS.md +0 -45
- package/dist/templates/static/README.md +0 -9
- package/dist/templates/static/_gitignore +0 -2
- package/dist/templates/static/canopy.json +0 -4
- package/dist/templates/static/index.html +0 -21
- package/dist/templates/static/main.js +0 -9
- package/dist/templates/static/style.css +0 -29
- package/dist/templates/worker/.dev.vars.example +0 -9
- package/dist/templates/worker/.github/workflows/canopy-deploy.yml +0 -34
- package/dist/templates/worker/AGENTS.md +0 -63
- package/dist/templates/worker/README.md +0 -17
- package/dist/templates/worker/_gitignore +0 -5
- package/dist/templates/worker/canopy.json +0 -6
- package/dist/templates/worker/index.html +0 -12
- package/dist/templates/worker/package.json +0 -22
- package/dist/templates/worker/src/app.tsx +0 -25
- package/dist/templates/worker/src/canopy.ts +0 -5
- package/dist/templates/worker/src/main.tsx +0 -10
- package/dist/templates/worker/src/style.css +0 -29
- package/dist/templates/worker/tsconfig.json +0 -16
- package/dist/templates/worker/vite.config.ts +0 -7
- package/dist/templates/worker/worker/index.ts +0 -52
package/dist/docs/data.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Working with project data
|
|
3
|
-
description: Pulling, snapshotting, and restoring your project database.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Each Canopy project gets its own database and blob storage (D1 and R2 on the
|
|
7
|
-
Cloudflare target; Postgres and GCS on GCP). Your app reads and writes them
|
|
8
|
-
through the Canopy SDK at runtime; the CLI gives you tools to manage the data
|
|
9
|
-
around it.
|
|
10
|
-
|
|
11
|
-
## Collections in your app (SDK)
|
|
12
|
-
|
|
13
|
-
The paved road is document-style collections:
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
await canopy.db.collection("blog_posts").insert({ title: "Hello" });
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**Collection names must be lowercase** — start with a letter, then letters,
|
|
20
|
-
digits, and underscores only (`^[a-z][a-z0-9_]*$`). `blog_posts` is fine;
|
|
21
|
-
`blogPosts` or `BlogPosts` are **not** and throw at runtime:
|
|
22
|
-
|
|
23
|
-
> `Invalid collection name "BlogPosts" — use lowercase letters, digits and underscores.`
|
|
24
|
-
|
|
25
|
-
Use `snake_case` for multi-word names. This mirrors the collection name straight
|
|
26
|
-
into the underlying database, so keeping it lowercase avoids case-sensitivity
|
|
27
|
-
surprises.
|
|
28
|
-
|
|
29
|
-
## Dialects and raw SQL
|
|
30
|
-
|
|
31
|
-
The document API above is portable — it behaves the same on every platform
|
|
32
|
-
target. Raw SQL is not: `canopy.db.sql()` passes your statement through
|
|
33
|
-
untranslated, so it speaks whatever the target's database speaks. Ask the
|
|
34
|
-
platform which that is:
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
await canopy.db.dialect(); // "sqlite" | "postgres"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Parameterize with `?` on sqlite and `$1` on postgres. One more per-target
|
|
41
|
-
difference: `collection().search()` is real full-text search (FTS5) on sqlite
|
|
42
|
-
targets, and a plain substring match on postgres targets — different matches,
|
|
43
|
-
no ranking.
|
|
44
|
-
|
|
45
|
-
## Download a dump
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
canopy db pull # writes <slug>-<timestamp>.sql
|
|
49
|
-
canopy db pull --out data.sql # choose the filename
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
A plain SQL dump you can inspect, diff, or keep as a backup.
|
|
53
|
-
|
|
54
|
-
## Snapshots (server-side backups)
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
canopy db snapshot # store a dump on the platform
|
|
58
|
-
canopy db snapshots # list stored snapshots
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Snapshots live on the platform and can be restored at any time — handy before a
|
|
62
|
-
risky change.
|
|
63
|
-
|
|
64
|
-
## Restore — destructive
|
|
65
|
-
|
|
66
|
-
> **Warning:** Restoring **replaces ALL project data**. Take a snapshot first — a snapshot taken seconds earlier
|
|
67
|
-
> is your undo button.
|
|
68
|
-
|
|
69
|
-
Restore from either source:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
canopy db restore backup.sql # from a local dump
|
|
73
|
-
canopy db restore --snapshot <key> # from a server-side snapshot
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
You'll be asked to type the project slug to confirm. `--yes` skips that prompt —
|
|
77
|
-
use it only in scripts you trust.
|
|
78
|
-
|
|
79
|
-
## Safe workflow for agents
|
|
80
|
-
|
|
81
|
-
Before any destructive data change:
|
|
82
|
-
|
|
83
|
-
1. `canopy db snapshot` — take a restore point.
|
|
84
|
-
2. Make the change (or test it first with `canopy dev --local --pull`).
|
|
85
|
-
3. If something goes wrong, `canopy db restore --snapshot <key>`.
|
package/dist/docs/deploy.md
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Deploying a project
|
|
3
|
-
description: How canopy deploy builds, uploads, and makes a version live.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
From inside a project directory:
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
canopy deploy
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
This uploads your built assets to the platform, creates a new immutable deploy
|
|
13
|
-
version, and makes it live. Each deploy is versioned (`v1`, `v2`, …).
|
|
14
|
-
|
|
15
|
-
Under the hood a deploy is three steps: the platform authorizes it and issues a
|
|
16
|
-
short-lived signed upload grant, the CLI uploads each file directly against
|
|
17
|
-
that grant, and a completion call checks the bundle and makes the new version
|
|
18
|
-
live. You only ever run `canopy deploy` — but it means a half-uploaded deploy
|
|
19
|
-
is never served.
|
|
20
|
-
|
|
21
|
-
## Building first
|
|
22
|
-
|
|
23
|
-
If your project needs a build step (React SPA, anything with a bundler), declare
|
|
24
|
-
the build command in `canopy.json` — `canopy deploy` runs it automatically
|
|
25
|
-
before uploading. To skip the build and upload whatever is already in the
|
|
26
|
-
output directory (or the static files as-is for a `static` project):
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
canopy deploy --no-build
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Trying it on staging first
|
|
33
|
-
|
|
34
|
-
Nervous about a change — especially one with schema migrations or backend
|
|
35
|
-
code? Deploy it to the project's staging channel first, then promote the exact
|
|
36
|
-
same version once it checks out:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
canopy deploy --staging # own URL, own database (a copy of live)
|
|
40
|
-
canopy promote # make that version live
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
See [Staging & promoting](https://docs.canopy.website/guides/staging).
|
|
44
|
-
|
|
45
|
-
## Rolling back
|
|
46
|
-
|
|
47
|
-
Every deploy is kept, so you can instantly revert:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
canopy rollback # pick a version from history
|
|
51
|
-
canopy rollback v3 # make v3 live again
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Rollback re-points the live version at an existing deploy — it does not
|
|
55
|
-
rebuild, and the project's backend rolls back with it.
|
|
56
|
-
|
|
57
|
-
## Downloading a version
|
|
58
|
-
|
|
59
|
-
Every version's assets can be pulled back down as a zip — the exact files that
|
|
60
|
-
were deployed, for any version in the history:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
canopy download # the live version (pick from history in a terminal)
|
|
64
|
-
canopy download v3 # a specific version
|
|
65
|
-
canopy download v3 --out release.zip
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
The same download is available per version from the dashboard (project overview
|
|
69
|
-
→ Deploys). Handy for archiving a release or moving a matured project off the
|
|
70
|
-
platform.
|
|
71
|
-
|
|
72
|
-
## Seeing the live site
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
canopy open
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Deploying from CI
|
|
79
|
-
|
|
80
|
-
For automated push-to-main deploys, use a deploy token instead of an interactive
|
|
81
|
-
login — see `canopy docs ci`.
|
package/dist/docs/dev.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Local development
|
|
3
|
-
description: Running a project locally against live or sandboxed data.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
From inside a project directory:
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
canopy dev
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
By default `canopy dev` runs your project locally but talks to **live platform
|
|
13
|
-
data** (your project's real database, blobs, and AI). This is the fastest way to
|
|
14
|
-
develop against realistic state.
|
|
15
|
-
|
|
16
|
-
- `--port <port>` — choose the dev-server port.
|
|
17
|
-
|
|
18
|
-
## Offline sandbox
|
|
19
|
-
|
|
20
|
-
To develop without touching live data — for example on a plane, or before you
|
|
21
|
-
trust a destructive change — use a local sandbox backed by an embedded database
|
|
22
|
-
and a filesystem blob store:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
canopy dev --local
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
This creates a local database and blobs under `.canopy/local/` in your
|
|
29
|
-
project. The sandbox starts empty.
|
|
30
|
-
|
|
31
|
-
To seed the sandbox from a fresh copy of production data first:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
canopy dev --local --pull
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`.canopy/local/` is disposable — delete it to reset the sandbox.
|
|
38
|
-
|
|
39
|
-
By default the sandbox runs PGlite (embedded Postgres), so raw
|
|
40
|
-
`canopy.db.sql()` speaks the postgres dialect there, while your deployed
|
|
41
|
-
project speaks whatever its platform target speaks (`canopy.db.dialect()`
|
|
42
|
-
tells you — sqlite on Cloudflare). Collections (`canopy.db.collection(...)`)
|
|
43
|
-
behave the same in both, so this only matters for hand-written SQL — see
|
|
44
|
-
`canopy docs data`. If your project's raw SQL targets a sqlite site, lock the
|
|
45
|
-
dialect in `canopy.json` (`"dialect": "sqlite"`) and the sandbox runs an
|
|
46
|
-
embedded SQLite engine instead, so the same SQL works locally and deployed —
|
|
47
|
-
see [canopy dev](https://docs.canopy.website/cli/dev).
|
|
48
|
-
|
|
49
|
-
## Backend worker
|
|
50
|
-
|
|
51
|
-
Projects with a `worker` entry in `canopy.json` get their backend locally too:
|
|
52
|
-
`/api/*` is served by your worker in both modes, with the same `env` it has in
|
|
53
|
-
production (`env.CANOPY`, `env.DB`, `env.BLOB`, `env.USER`). Edit and refresh —
|
|
54
|
-
there's no build step.
|
|
55
|
-
|
|
56
|
-
Secrets are the one thing that doesn't come from the dashboard. Stored values
|
|
57
|
-
are never downloadable, so put local ones in a `.dev.vars` file next to
|
|
58
|
-
`canopy.json`:
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
STRIPE_KEY=sk_test_local
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Your worker reads them the same way it reads dashboard secrets
|
|
65
|
-
(`c.env.STRIPE_KEY`). `canopy dev` prints which dashboard secret names your
|
|
66
|
-
`.dev.vars` is missing. Keep the file out of git — the scaffolds ignore it.
|
|
67
|
-
|
|
68
|
-
## Which mode should an agent use?
|
|
69
|
-
|
|
70
|
-
- Iterating on UI or read-only features → `canopy dev` (live data, realistic).
|
|
71
|
-
- Testing writes, migrations, or anything destructive → `canopy dev --local`
|
|
72
|
-
(optionally `--pull` to start from real data).
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Building with agents
|
|
3
|
-
description: Teach your coding agent Canopy — the agent skill, offline docs, template guardrails, and prompts that work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Canopy is built to be driven by coding agents. Three pieces make that work:
|
|
7
|
-
an installable agent skill, docs the CLI carries offline, and guardrail files
|
|
8
|
-
every new project ships with. Set them up once and your agent knows how to
|
|
9
|
-
scaffold, run, deploy, and manage data without guessing.
|
|
10
|
-
|
|
11
|
-
## Install the skill
|
|
12
|
-
|
|
13
|
-
From your project (or any repo the agent works in):
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
canopy skill install
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This writes the skill to the tool-neutral `.agents/skills/canopy/` tree and
|
|
20
|
-
symlinks `.claude/skills/canopy` to it, so Claude Code picks it up while other
|
|
21
|
-
agents read `.agents/`. `canopy upgrade` refreshes it alongside the CLI.
|
|
22
|
-
|
|
23
|
-
The skill teaches an agent to:
|
|
24
|
-
|
|
25
|
-
- **Check install and login first** — `canopy --version`, `canopy whoami`,
|
|
26
|
-
and how to run `canopy login` correctly (hand the browser sign-in to the
|
|
27
|
-
human; never touch credentials).
|
|
28
|
-
- **Read docs before acting** — prefer `canopy docs <topic>` and
|
|
29
|
-
`canopy <command> --help` over guessing flags.
|
|
30
|
-
- **Choose the right starter** — `spa` for anything real (typed SDK),
|
|
31
|
-
`static` only for trivial pages, `worker` when server-side code is needed —
|
|
32
|
-
and use `canopy init <slug>` (never `canopy create`) for a project that
|
|
33
|
-
already exists.
|
|
34
|
-
- **Respect safety rules** — confirm before deploys, snapshot before
|
|
35
|
-
`canopy db restore`, treat `canopy delete` as destructive.
|
|
36
|
-
|
|
37
|
-
## Offline docs for agents
|
|
38
|
-
|
|
39
|
-
The CLI ships the full platform documentation and keeps it fresh from the
|
|
40
|
-
platform, so an agent can read it without a browser — even before signing in:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
canopy docs # list all topics
|
|
44
|
-
canopy docs deploy # print one topic
|
|
45
|
-
canopy docs cli --refresh # force a re-fetch from the platform
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Topics mirror the [guides](https://docs.canopy.website/guides/getting-started) on this site:
|
|
49
|
-
`getting-started`, `cli`, `dev`, `deploy`, `data`, `ci`, `troubleshooting`,
|
|
50
|
-
and more.
|
|
51
|
-
|
|
52
|
-
## Template guardrails
|
|
53
|
-
|
|
54
|
-
Every scaffolded project includes an `AGENTS.md` (the agent-facing README)
|
|
55
|
-
that encodes the platform's boundaries, so an agent starting cold in the repo
|
|
56
|
-
already knows the rules:
|
|
57
|
-
|
|
58
|
-
- **Don't add auth** — the platform authenticates every request first.
|
|
59
|
-
- **Don't store secrets** in the repo or browser code; set them in the
|
|
60
|
-
dashboard, and only a backend worker reads them.
|
|
61
|
-
- **No SSR, no custom servers, no external databases** — data goes through
|
|
62
|
-
`canopy.db` and `canopy.blob`.
|
|
63
|
-
- `canopy dev` uses **live** project data: snapshot before risky writes, or
|
|
64
|
-
use `canopy dev --local` for an offline sandbox where writes never reach
|
|
65
|
-
the platform.
|
|
66
|
-
|
|
67
|
-
## Prompts that work
|
|
68
|
-
|
|
69
|
-
With the skill installed, these are safe, copy-pasteable asks — each maps to
|
|
70
|
-
commands the skill and docs actually cover:
|
|
71
|
-
|
|
72
|
-
```text
|
|
73
|
-
Set up Canopy in this repo: check the CLI is installed and I'm logged in,
|
|
74
|
-
then install the Canopy skill and skim `canopy docs getting-started`.
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
```text
|
|
78
|
-
Create a new Canopy project for a team lunch-voting app (spa template),
|
|
79
|
-
run it locally with `canopy dev`, and build the first version of the UI.
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
```text
|
|
83
|
-
Deploy this project to Canopy, then open the live site so I can check it.
|
|
84
|
-
If anything looks wrong, roll back to the previous version.
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
Take a database snapshot, then pull the production data with
|
|
89
|
-
`canopy db pull` and use the dump to reproduce the bug locally with
|
|
90
|
-
`canopy dev --local --pull`.
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
> **Note:** Deploys go live behind company sign-in and restores replace all project data — a well-behaved
|
|
94
|
-
> agent will confirm both with you first. That caution comes from the skill; keep it installed and
|
|
95
|
-
> current.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: How the platform serves your project
|
|
3
|
-
description: What happens between a browser and your deployed code — auth wall, static assets, the optional backend worker, and where data lives.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You never manage servers on Canopy, but it helps to know what the platform
|
|
7
|
-
does with a request. This page covers the pieces a project developer actually
|
|
8
|
-
touches; platform internals stay out of it.
|
|
9
|
-
|
|
10
|
-
## The request path
|
|
11
|
-
|
|
12
|
-
Every project lives at `https://<slug>.canopy.<domain>`. Requests hit the
|
|
13
|
-
**gateway** first, which enforces authentication before any of your project's
|
|
14
|
-
bytes are served — then either serves your deployed static files or, if the
|
|
15
|
-
project has one, dispatches `/api/*` to your backend worker.
|
|
16
|
-
|
|
17
|
-
```mermaid
|
|
18
|
-
flowchart TD
|
|
19
|
-
B[Browser] --> G["Gateway<br/>auth wall: OneLogin session<br/>or client password"]
|
|
20
|
-
G -->|"most paths"| A["Static assets<br/>deployed build, SPA fallback"]
|
|
21
|
-
G -->|"/api/*"| W["Backend worker<br/>(optional, canopy.json 'worker')"]
|
|
22
|
-
G -->|"/_api/data/v1/*"| P["Platform data plane<br/>auth · db · blob · ai"]
|
|
23
|
-
W --> P
|
|
24
|
-
P --> D[("Project database<br/>+ blob prefix")]
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## The auth wall
|
|
28
|
-
|
|
29
|
-
Authentication is a platform property — your app cannot opt out, and must not
|
|
30
|
-
build its own. A visitor without a valid session is redirected into the
|
|
31
|
-
OneLogin sign-in flow; on projects with client access enabled, outsiders get a
|
|
32
|
-
password page and receive a scope-limited `external` session instead. Only
|
|
33
|
-
after that does any project code or asset get served. Your app just asks
|
|
34
|
-
`canopy.auth.user()` who came through the door
|
|
35
|
-
(see the [SDK reference](https://docs.canopy.website/sdk)).
|
|
36
|
-
|
|
37
|
-
## Static assets and the SPA fallback
|
|
38
|
-
|
|
39
|
-
A deploy uploads your built files as an immutable, numbered version; serving
|
|
40
|
-
reads whichever version is live. Requests for paths that don't match a file
|
|
41
|
-
fall back to `index.html`, so client-side routes like `/settings` work on a
|
|
42
|
-
hard refresh without any configuration. Rollback just repoints "live" at an
|
|
43
|
-
earlier version — instant, nothing rebuilt.
|
|
44
|
-
|
|
45
|
-
The full path — including caching, version-pinned `v12-dot-<slug>` preview
|
|
46
|
-
hosts, and the security review — is in
|
|
47
|
-
[How static files are served](https://docs.canopy.website/guides/static-serving).
|
|
48
|
-
|
|
49
|
-
## The optional backend worker
|
|
50
|
-
|
|
51
|
-
Most projects are frontend-only: the SDK talks straight to the platform, and
|
|
52
|
-
no server code exists. When you need server-side code — say, calling an
|
|
53
|
-
external API with a secret the browser can't hold — the `worker` template adds
|
|
54
|
-
a backend, declared in `canopy.json`:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
{
|
|
58
|
-
"slug": "my-app",
|
|
59
|
-
"build": "npm run build",
|
|
60
|
-
"dist": "dist",
|
|
61
|
-
"worker": "worker/index.ts"
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Requests under `/api/*` reach the worker (Hono-style handlers); everything
|
|
66
|
-
else is still static serving. Three things to know:
|
|
67
|
-
|
|
68
|
-
- **Requests arrive authenticated.** The worker sits behind the same gateway
|
|
69
|
-
wall as the frontend.
|
|
70
|
-
- **Platform access goes through the same SDK**, via the `CANOPY` service
|
|
71
|
-
binding — same budgets, same data isolation as the browser:
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
app.get("/api/hello", async (c) => {
|
|
75
|
-
const canopy = createCanopy({ fetch: c.env.CANOPY.fetch.bind(c.env.CANOPY) });
|
|
76
|
-
const user = await canopy.auth.user();
|
|
77
|
-
return c.json({ message: `Hello, ${user.name}!` });
|
|
78
|
-
});
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
- **Secrets and schedules come from the dashboard.** Secrets (Settings →
|
|
82
|
-
Secrets) land as Workers-shaped bindings (`c.env.MY_API_KEY`, not
|
|
83
|
-
`process.env`); dashboard Schedules invoke an exported
|
|
84
|
-
`scheduled(event, env)` — switch on `event.name`.
|
|
85
|
-
|
|
86
|
-
> **Warning:** Backend workers are capability-gated per target: today the GCP target runs them, while on
|
|
87
|
-
> Cloudflare sites a worker deploy answers a clear "not supported yet". Frontend-only projects
|
|
88
|
-
> deploy everywhere.
|
|
89
|
-
|
|
90
|
-
## Where your data lives
|
|
91
|
-
|
|
92
|
-
Every project gets its own database and its own blob-storage prefix. No other
|
|
93
|
-
project can read them, and deleting the project tears everything down. The
|
|
94
|
-
document API is portable across targets; raw SQL speaks the target's dialect
|
|
95
|
-
(`sqlite` or `postgres` — ask `canopy.db.dialect()`). Dumps, snapshots, and
|
|
96
|
-
restores are CLI commands — see the [project data guide](https://docs.canopy.website/guides/data).
|
|
97
|
-
|
|
98
|
-
## Sites
|
|
99
|
-
|
|
100
|
-
A _site_ is one installation of the whole platform. The CLI ships three
|
|
101
|
-
profiles — `main` (canopy.website, Cloudflare), `staging` (thanarie.dev,
|
|
102
|
-
Cloudflare), and `gcp-pilot` (canopy.monks.zone, GCP) — and always shows which
|
|
103
|
-
one you're on. Projects pin theirs in `canopy.json`; `--profile` or
|
|
104
|
-
`CANOPY_PROFILE` overrides per command. Most projects only ever use `main`.
|
|
105
|
-
Target differences (dialect, full-text search, worker support) surface as
|
|
106
|
-
capabilities, not separate APIs.
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Getting started
|
|
3
|
-
description: Install the CLI, sign in with OneLogin, and ship your first project.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Canopy is Monks' managed platform for vibecoded projects. You build a small web
|
|
7
|
-
app, and Canopy hosts it, gives it a database, blob storage, and AI — no
|
|
8
|
-
infrastructure to manage.
|
|
9
|
-
|
|
10
|
-
This guide is written so an AI coding agent (Claude, Cursor, etc.) can follow it
|
|
11
|
-
on your behalf. Everything runs through one command-line tool: `canopy`.
|
|
12
|
-
|
|
13
|
-
## 1. Install the CLI
|
|
14
|
-
|
|
15
|
-
The CLI is published on npm. Install it globally:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install -g @mediamonks/canopy-cli
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Confirm it's on your PATH:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
canopy --version
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
If `npm` isn't available, install Node.js 20+ first (https://nodejs.org), then
|
|
28
|
-
re-run the install.
|
|
29
|
-
|
|
30
|
-
## 2. Sign in
|
|
31
|
-
|
|
32
|
-
Canopy authenticates through Monks' OneLogin. Run:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
canopy login
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
This opens your browser. **Finish the sign-in there** — the CLI waits for the
|
|
39
|
-
browser to redirect back, then stores a token in `~/.canopy/config.json`.
|
|
40
|
-
|
|
41
|
-
> If you are an agent: run `canopy login`, then stop and tell the human to
|
|
42
|
-
> complete the sign-in in the browser window that just opened. Never ask for or
|
|
43
|
-
> type the user's password or any codes yourself.
|
|
44
|
-
|
|
45
|
-
Check who you are at any time:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
canopy whoami
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## 3. Create your first project
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
canopy create
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
This prompts for a name and a starter template, scaffolds a runnable project
|
|
58
|
-
directory, and registers the project on the platform. To skip the prompts:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
canopy create "My App" --scaffold --template spa
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
> If you are an agent: don't stop at printing this command. Ask the person what
|
|
65
|
-
> they'd like to build and what it's about, then pick a name and template for
|
|
66
|
-
> them and run `canopy create` non-interactively — then keep going and build
|
|
67
|
-
> it. Aim for a working first project, not a list of commands.
|
|
68
|
-
|
|
69
|
-
Templates: **`static`** (no-build html/css/js; SDK served untyped from the
|
|
70
|
-
platform) is the default and fine for a trivial page or two. Reach for
|
|
71
|
-
**`spa`** (Vite + React + TypeScript; typed SDK from npm) once you lean on the
|
|
72
|
-
SDK or expect the app to grow — most projects want this.
|
|
73
|
-
|
|
74
|
-
## 4. Run it locally
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
cd my-app
|
|
78
|
-
canopy dev
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Your project runs against live platform data by default. For an offline sandbox
|
|
82
|
-
with local data, use `canopy dev --local`.
|
|
83
|
-
|
|
84
|
-
## 5. Deploy
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
canopy deploy
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Then open the live site:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
canopy open
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Where to go next
|
|
97
|
-
|
|
98
|
-
Everything the CLI can do is documented and available offline. List the topics:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
canopy docs
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Read one, e.g.:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
canopy docs deploy
|
|
108
|
-
```
|