@mediamonks/canopy-cli 0.7.11 → 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.
Files changed (108) hide show
  1. package/dist/{deploy-BCtEY1is.mjs → deploy-B1WrPq5W.mjs} +8 -1
  2. package/dist/{dev-DtoZrexp.mjs → dev-BnUYGQQm.mjs} +5 -4
  3. package/dist/dev-CySBxW7I.mjs +2 -0
  4. package/dist/{dev-worker-BZgtEM9V.mjs → dev-worker-IWnHvQ1f.mjs} +42 -7
  5. package/dist/{docs-BV9qhLJx.mjs → docs-DxB7NhZs.mjs} +1 -1
  6. package/dist/{feedback-Cb8ccQ_R.mjs → feedback-B-GXUBPs.mjs} +1 -1
  7. package/dist/index.mjs +10 -10
  8. package/dist/{local-C5AhA4GM.mjs → local-BGRd_FMZ.mjs} +6 -469
  9. package/dist/{package-BBpw-n7k.mjs → package-CDLufecy.mjs} +1 -1
  10. package/dist/{skill-DJHlTEhS.mjs → skill-BOWfqwr2.mjs} +1 -1
  11. package/dist/src-Bu4Ze32I.mjs +470 -0
  12. package/dist/{upgrade-B86Ao6T5.mjs → upgrade-fhfrid_O.mjs} +1 -1
  13. package/package.json +3 -3
  14. package/dist/dev-BYxSHUH6.mjs +0 -2
  15. package/dist/docs/ci.md +0 -50
  16. package/dist/docs/cli-create.md +0 -46
  17. package/dist/docs/cli-db.md +0 -86
  18. package/dist/docs/cli-delete.md +0 -44
  19. package/dist/docs/cli-deploy.md +0 -58
  20. package/dist/docs/cli-dev.md +0 -82
  21. package/dist/docs/cli-docs.md +0 -47
  22. package/dist/docs/cli-download.md +0 -42
  23. package/dist/docs/cli-egress.md +0 -37
  24. package/dist/docs/cli-feedback.md +0 -75
  25. package/dist/docs/cli-index.md +0 -61
  26. package/dist/docs/cli-init.md +0 -46
  27. package/dist/docs/cli-login.md +0 -43
  28. package/dist/docs/cli-logout.md +0 -32
  29. package/dist/docs/cli-logs.md +0 -57
  30. package/dist/docs/cli-open.md +0 -41
  31. package/dist/docs/cli-projects.md +0 -43
  32. package/dist/docs/cli-promote.md +0 -44
  33. package/dist/docs/cli-rollback.md +0 -45
  34. package/dist/docs/cli-skill.md +0 -39
  35. package/dist/docs/cli-staging.md +0 -54
  36. package/dist/docs/cli-token.md +0 -47
  37. package/dist/docs/cli-upgrade.md +0 -43
  38. package/dist/docs/cli-usage.md +0 -43
  39. package/dist/docs/cli-whoami.md +0 -46
  40. package/dist/docs/cli.md +0 -86
  41. package/dist/docs/data.md +0 -85
  42. package/dist/docs/deploy.md +0 -81
  43. package/dist/docs/dev.md +0 -72
  44. package/dist/docs/developers-agents-and-ai.md +0 -95
  45. package/dist/docs/developers-architecture.md +0 -106
  46. package/dist/docs/getting-started.md +0 -108
  47. package/dist/docs/index.json +0 -331
  48. package/dist/docs/infrastructure.md +0 -406
  49. package/dist/docs/migrations.md +0 -183
  50. package/dist/docs/overview-faq.md +0 -105
  51. package/dist/docs/overview-how-it-works.md +0 -82
  52. package/dist/docs/overview-use-cases.md +0 -76
  53. package/dist/docs/overview-what-is-canopy.md +0 -75
  54. package/dist/docs/platform-ai-usage.md +0 -65
  55. package/dist/docs/platform-client-access.md +0 -54
  56. package/dist/docs/platform-deploys-and-rollbacks.md +0 -93
  57. package/dist/docs/platform-egress.md +0 -75
  58. package/dist/docs/platform-feedback.md +0 -114
  59. package/dist/docs/platform-members-and-access.md +0 -71
  60. package/dist/docs/platform-project-data.md +0 -76
  61. package/dist/docs/platform-schedules.md +0 -90
  62. package/dist/docs/platform-sites-and-profiles.md +0 -61
  63. package/dist/docs/porting-nextjs.md +0 -233
  64. package/dist/docs/sdk-ai.md +0 -103
  65. package/dist/docs/sdk-auth.md +0 -57
  66. package/dist/docs/sdk-database.md +0 -126
  67. package/dist/docs/sdk-files.md +0 -82
  68. package/dist/docs/sdk-services.md +0 -58
  69. package/dist/docs/sdk.md +0 -126
  70. package/dist/docs/staging.md +0 -106
  71. package/dist/docs/static-serving.md +0 -318
  72. package/dist/docs/troubleshooting.md +0 -102
  73. package/dist/skill/canopy/SKILL.md +0 -160
  74. package/dist/templates/spa/.github/workflows/canopy-deploy.yml +0 -34
  75. package/dist/templates/spa/AGENTS.md +0 -47
  76. package/dist/templates/spa/README.md +0 -14
  77. package/dist/templates/spa/_gitignore +0 -4
  78. package/dist/templates/spa/canopy.json +0 -5
  79. package/dist/templates/spa/index.html +0 -12
  80. package/dist/templates/spa/package.json +0 -21
  81. package/dist/templates/spa/src/app.tsx +0 -25
  82. package/dist/templates/spa/src/canopy.ts +0 -5
  83. package/dist/templates/spa/src/main.tsx +0 -10
  84. package/dist/templates/spa/src/style.css +0 -29
  85. package/dist/templates/spa/tsconfig.json +0 -16
  86. package/dist/templates/spa/vite.config.ts +0 -7
  87. package/dist/templates/static/AGENTS.md +0 -45
  88. package/dist/templates/static/README.md +0 -9
  89. package/dist/templates/static/_gitignore +0 -2
  90. package/dist/templates/static/canopy.json +0 -4
  91. package/dist/templates/static/index.html +0 -21
  92. package/dist/templates/static/main.js +0 -9
  93. package/dist/templates/static/style.css +0 -29
  94. package/dist/templates/worker/.dev.vars.example +0 -9
  95. package/dist/templates/worker/.github/workflows/canopy-deploy.yml +0 -34
  96. package/dist/templates/worker/AGENTS.md +0 -63
  97. package/dist/templates/worker/README.md +0 -17
  98. package/dist/templates/worker/_gitignore +0 -5
  99. package/dist/templates/worker/canopy.json +0 -6
  100. package/dist/templates/worker/index.html +0 -12
  101. package/dist/templates/worker/package.json +0 -22
  102. package/dist/templates/worker/src/app.tsx +0 -25
  103. package/dist/templates/worker/src/canopy.ts +0 -5
  104. package/dist/templates/worker/src/main.tsx +0 -10
  105. package/dist/templates/worker/src/style.css +0 -29
  106. package/dist/templates/worker/tsconfig.json +0 -16
  107. package/dist/templates/worker/vite.config.ts +0 -7
  108. package/dist/templates/worker/worker/index.ts +0 -52
@@ -1,14 +0,0 @@
1
- # {{name}}
2
-
3
- A [Canopy](https://dashboard.thanarie.dev) project — Vite + React. Live
4
- (behind company login) at https://{{slug}}.thanarie.dev after the first
5
- `canopy deploy`.
6
-
7
- - `npm install` — once, then:
8
- - `canopy dev` — develop locally against the live platform (real data!)
9
- - `canopy dev --local [--pull]` — offline sandbox with local data instead
10
- - `canopy deploy` — build and publish `dist/`
11
- - `AGENTS.md` — project guardrails and skill setup for coding agents
12
-
13
- Push-to-main deploys are prepared in `.github/workflows/canopy-deploy.yml`
14
- (needs a `CANOPY_DEPLOY_TOKEN` repo secret — see the workflow file).
@@ -1,4 +0,0 @@
1
- node_modules/
2
- dist/
3
- .canopy/
4
- .DS_Store
@@ -1,5 +0,0 @@
1
- {
2
- "slug": "{{slug}}",
3
- "build": "npm run build",
4
- "dist": "dist"
5
- }
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{name}}</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.tsx"></script>
11
- </body>
12
- </html>
@@ -1,21 +0,0 @@
1
- {
2
- "name": "{{slug}}",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "dev": "canopy dev",
7
- "build": "tsc && vite build"
8
- },
9
- "dependencies": {
10
- "@mediamonks/canopy": "^0.0.4",
11
- "react": "^19.1.0",
12
- "react-dom": "^19.1.0"
13
- },
14
- "devDependencies": {
15
- "@types/react": "^19.1.0",
16
- "@types/react-dom": "^19.1.0",
17
- "@vitejs/plugin-react": "^5.0.0",
18
- "typescript": "^5.8.0",
19
- "vite": "^7.0.0"
20
- }
21
- }
@@ -1,25 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { canopy } from "./canopy.ts";
3
-
4
- export function App() {
5
- const [status, setStatus] = useState("connecting to Canopy…");
6
-
7
- useEffect(() => {
8
- canopy.auth
9
- .user()
10
- .then((user) => setStatus(`signed in as ${user.email}`))
11
- .catch(() => setStatus("could not reach Canopy — is `canopy dev` running?"));
12
- }, []);
13
-
14
- return (
15
- <main>
16
- <h1>{"{{name}}"}</h1>
17
- <p className="status">{status}</p>
18
- <section>
19
- <p className="placeholder">
20
- Start building — edit <code>src/app.tsx</code>, then run <code>canopy deploy</code>.
21
- </p>
22
- </section>
23
- </main>
24
- );
25
- }
@@ -1,5 +0,0 @@
1
- // One SDK instance for the whole app. Auth (auth), data (db), files (blob)
2
- // and AI (ai) are all live — see AGENTS.md for how to get the full reference.
3
- import { createCanopy } from "@mediamonks/canopy";
4
-
5
- export const canopy = createCanopy();
@@ -1,10 +0,0 @@
1
- import { StrictMode } from "react";
2
- import { createRoot } from "react-dom/client";
3
- import { App } from "./app.tsx";
4
- import "./style.css";
5
-
6
- createRoot(document.getElementById("root") as HTMLElement).render(
7
- <StrictMode>
8
- <App />
9
- </StrictMode>,
10
- );
@@ -1,29 +0,0 @@
1
- :root {
2
- font-family: system-ui, sans-serif;
3
- color-scheme: light dark;
4
- }
5
-
6
- body {
7
- margin: 0;
8
- display: grid;
9
- place-items: center;
10
- min-height: 100vh;
11
- }
12
-
13
- main {
14
- max-width: 40rem;
15
- padding: 2rem;
16
- text-align: center;
17
- }
18
-
19
- .status {
20
- font-size: 0.9rem;
21
- opacity: 0.7;
22
- }
23
-
24
- .placeholder {
25
- border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
26
- border-radius: 8px;
27
- padding: 1.5rem;
28
- opacity: 0.6;
29
- }
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "jsx": "react-jsx",
8
- "strict": true,
9
- "noEmit": true,
10
- "skipLibCheck": true,
11
- "isolatedModules": true,
12
- "allowImportingTsExtensions": true,
13
- "noUncheckedIndexedAccess": true
14
- },
15
- "include": ["src", "vite.config.ts"]
16
- }
@@ -1,7 +0,0 @@
1
- import react from "@vitejs/plugin-react";
2
- import { defineConfig } from "vite";
3
-
4
- // `canopy dev` picks this config up and adds its own /_api proxy on top.
5
- export default defineConfig({
6
- plugins: [react()],
7
- });
@@ -1,45 +0,0 @@
1
- # {{name}} — a Canopy static app
2
-
3
- A no-build web app on [Canopy](https://dashboard.thanarie.dev), Monks' managed
4
- platform for internal projects. Everything is served behind company login;
5
- there is no infrastructure to manage and none should be added.
6
-
7
- ## Canopy skill
8
-
9
- The full SDK reference (auth, db, blob, ai) and platform guardrails ship as an
10
- agent skill, kept out of this scaffold so it stays current. Install it before
11
- building features:
12
-
13
- ```
14
- npx skills add mediamonks/canopy
15
- ```
16
-
17
- If that fails the skill isn't published yet — the SDK surface is documented on
18
- the [Canopy dashboard](https://dashboard.thanarie.dev).
19
-
20
- ## Working on this project
21
-
22
- - Plain html/css/js in this directory — no bundler, no install step. The
23
- Canopy SDK is imported straight from the platform, so it always matches the
24
- API version: `import { createCanopy } from "/_api/data/v1/sdk.js";`
25
- - `canopy dev` — local dev server; its `/_api` proxies to the real platform.
26
- That is LIVE project data: read freely, but take a `canopy db snapshot`
27
- before risky data changes.
28
- - `canopy dev --local [--pull]` — offline sandbox with local data instead;
29
- writes never reach the platform. Prefer it for destructive experiments.
30
- - `canopy deploy` — publish; live (behind company login) at
31
- https://{{slug}}.thanarie.dev.
32
- - Risky change (schema migration, backend rework)? `canopy deploy --staging`
33
- first — a private copy with its own database cloned from live — verify, then
34
- `canopy promote` ships the exact tested version. Never promote with failing
35
- checks.
36
-
37
- ## Boundaries
38
-
39
- - Do not add auth — the platform authenticates every request before it
40
- reaches this app.
41
- - Do not store secrets anywhere in this project, and never call external APIs
42
- that need them from the browser — all backend needs go through the Canopy
43
- SDK (`canopy.auth`, `canopy.db`, `canopy.blob`, `canopy.ai`).
44
- - Keep it a static site: no SSR, no custom servers, no databases outside
45
- `canopy.db`.
@@ -1,9 +0,0 @@
1
- # {{name}}
2
-
3
- A [Canopy](https://dashboard.thanarie.dev) project. Live (behind company
4
- login) at https://{{slug}}.thanarie.dev after the first `canopy deploy`.
5
-
6
- - `canopy dev` — develop locally against the live platform (real data!)
7
- - `canopy dev --local [--pull]` — offline sandbox with local data instead
8
- - `canopy deploy` — publish the current directory
9
- - `AGENTS.md` — project guardrails and skill setup for coding agents
@@ -1,2 +0,0 @@
1
- .canopy/
2
- .DS_Store
@@ -1,4 +0,0 @@
1
- {
2
- "slug": "{{slug}}",
3
- "dist": "."
4
- }
@@ -1,21 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{name}}</title>
7
- <link rel="stylesheet" href="./style.css" />
8
- </head>
9
- <body>
10
- <main>
11
- <h1>{{name}}</h1>
12
- <p class="status" id="status">connecting to Canopy…</p>
13
- <section id="app">
14
- <p class="placeholder">
15
- Start building — edit <code>main.js</code>, then run <code>canopy deploy</code>.
16
- </p>
17
- </section>
18
- </main>
19
- <script type="module" src="./main.js"></script>
20
- </body>
21
- </html>
@@ -1,9 +0,0 @@
1
- // The Canopy SDK is served by the platform itself — nothing to install.
2
- // Auth (auth), data (db), files (blob) and AI (ai) are all live — see
3
- // AGENTS.md for how to get the full SDK reference.
4
- import { createCanopy } from "/_api/data/v1/sdk.js";
5
-
6
- const canopy = createCanopy();
7
-
8
- const user = await canopy.auth.user();
9
- document.getElementById("status").textContent = `signed in as ${user.email}`;
@@ -1,29 +0,0 @@
1
- :root {
2
- font-family: system-ui, sans-serif;
3
- color-scheme: light dark;
4
- }
5
-
6
- body {
7
- margin: 0;
8
- display: grid;
9
- place-items: center;
10
- min-height: 100vh;
11
- }
12
-
13
- main {
14
- max-width: 40rem;
15
- padding: 2rem;
16
- text-align: center;
17
- }
18
-
19
- .status {
20
- font-size: 0.9rem;
21
- opacity: 0.7;
22
- }
23
-
24
- .placeholder {
25
- border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
26
- border-radius: 8px;
27
- padding: 1.5rem;
28
- opacity: 0.6;
29
- }
@@ -1,9 +0,0 @@
1
- # Local worker secrets for `canopy dev` — copy to .dev.vars (gitignored).
2
- #
3
- # Dashboard secrets (Settings → Secrets) are never downloaded: the platform
4
- # can't hand a stored value back, and live keys don't belong on a laptop. Set
5
- # local stand-ins here; the worker reads them as c.env.NAME, exactly as it
6
- # reads the dashboard's in production. `canopy dev` prints which dashboard
7
- # secret names this file is missing.
8
- #
9
- # MY_API_KEY=local-test-key
@@ -1,34 +0,0 @@
1
- # Deploy to Canopy on every push to main. GitHub's runners are the build
2
- # farm — the platform owns no build infrastructure.
3
- #
4
- # Needs a CANOPY_DEPLOY_TOKEN repo secret: create a deploy token in the
5
- # dashboard (project → Settings → Deploy tokens) or with `canopy token
6
- # create`, then add it via `gh secret set CANOPY_DEPLOY_TOKEN` or the repo's
7
- # Settings → Secrets. Until the secret is set, this workflow skips itself
8
- # instead of failing the build.
9
- name: Deploy to Canopy
10
-
11
- on:
12
- push:
13
- branches: [main]
14
-
15
- jobs:
16
- deploy:
17
- runs-on: ubuntu-latest
18
- env:
19
- CANOPY_DEPLOY_TOKEN: ${{ secrets.CANOPY_DEPLOY_TOKEN }}
20
- steps:
21
- - uses: actions/checkout@v4
22
- - uses: actions/setup-node@v4
23
- with:
24
- node-version: 22
25
- - name: Install dependencies
26
- if: env.CANOPY_DEPLOY_TOKEN != ''
27
- run: |
28
- if [ -f package-lock.json ]; then npm ci; else npm install; fi
29
- - name: Deploy
30
- if: env.CANOPY_DEPLOY_TOKEN != ''
31
- run: npm exec --yes @mediamonks/canopy-cli deploy
32
- - name: Skipped (no deploy token)
33
- if: env.CANOPY_DEPLOY_TOKEN == ''
34
- run: echo "CANOPY_DEPLOY_TOKEN secret not set — skipping deploy."
@@ -1,63 +0,0 @@
1
- # {{name}} — a Canopy React SPA with a backend Worker
2
-
3
- A Vite + React single-page app plus a per-project backend Worker on
4
- [Canopy](https://dashboard.thanarie.dev), Monks' managed platform for internal
5
- projects. Everything is served behind company login; there is no
6
- infrastructure to manage and none should be added.
7
-
8
- ## Canopy skill
9
-
10
- The full SDK reference (auth, db, blob, ai) and platform guardrails ship as an
11
- agent skill, kept out of this scaffold so it stays current. Install it before
12
- building features:
13
-
14
- ```
15
- npx skills add mediamonks/canopy
16
- ```
17
-
18
- If that fails the skill isn't published yet — the SDK surface is documented on
19
- the [Canopy dashboard](https://dashboard.thanarie.dev).
20
-
21
- ## Working on this project
22
-
23
- - Frontend: a standard Vite + React + TypeScript app in `src/`; `npm install`
24
- once, then develop with `canopy dev` (it runs Vite with this project's
25
- `vite.config.ts` and proxies `/_api` to the platform).
26
- - Backend: Hono-style handlers in `worker/index.ts`, serving `/api/*`, plus an
27
- optional `scheduled(event, env)` for dashboard Schedules (switch on
28
- `event.name`). It runs behind the Canopy gateway (HTTP requests arrive
29
- authenticated) and reaches the platform through a service binding — same
30
- SDK, same budgets and data isolation as the browser.
31
- - `canopy dev` serves the worker as well: `/api/*` goes to
32
- `worker/index.ts` with the same `env` it gets deployed, no build step. Tick a
33
- schedule by hand with
34
- `curl -X POST localhost:5173/__canopy/scheduled -d '{"name":"<schedule>"}'`.
35
- - The SDK comes from npm (`@mediamonks/canopy`) — the browser's shared
36
- instance lives in `src/canopy.ts`.
37
- - `canopy dev` uses LIVE project data: read freely, but take a
38
- `canopy db snapshot` before risky data changes.
39
- - `canopy dev --local [--pull]` — offline sandbox with local data instead;
40
- writes never reach the platform. Prefer it for destructive experiments.
41
- - `canopy deploy` — builds (`npm run build`) and publishes; live (behind
42
- company login) at https://{{slug}}.thanarie.dev.
43
- - Defining your own tables (raw `sql()` / Drizzle)? Use the migrations flow —
44
- `canopy docs migrations`. Never invent a `DATABASE_URL` (none exists):
45
- generate migrations locally, and `canopy deploy` applies them.
46
- - Risky change (schema migration, backend rework)? `canopy deploy --staging`
47
- first — a private copy with its own database cloned from live — verify, then
48
- `canopy promote` ships the exact tested version. Never promote with failing
49
- checks.
50
-
51
- ## Boundaries
52
-
53
- - Do not add auth — the platform authenticates every request before it
54
- reaches this app or the Worker.
55
- - Do not store secrets in the repo or SPA. Set them in the Canopy dashboard
56
- (Settings → Secrets); the Worker reads them as `c.env.SECRET_NAME`
57
- (Workers-shaped bindings — not `process.env`). Locally, put stand-in values
58
- in `.dev.vars` (gitignored, see `.dev.vars.example`) — dashboard values are
59
- never downloaded, and `canopy dev` prints which names are still missing. Platform access still goes
60
- through the Canopy SDK (`canopy.auth`, `canopy.db`, `canopy.blob`,
61
- `canopy.ai`) in both the browser and the Worker.
62
- - The Worker is the only backend: no SSR, no long-running processes, no
63
- databases outside `canopy.db` / `c.env.DB`.
@@ -1,17 +0,0 @@
1
- # {{name}}
2
-
3
- A [Canopy](https://dashboard.thanarie.dev) project — Vite + React with a
4
- backend Worker (`worker/`). Live (behind company login) at
5
- https://{{slug}}.thanarie.dev after the first `canopy deploy`.
6
-
7
- - `npm install` — once, then:
8
- - `canopy dev` — develop locally against the live platform (real data!);
9
- `/api/*` is served by `worker/index.ts`, everything else by the SPA
10
- - `.dev.vars` — local values for the worker's secrets (copy
11
- `.dev.vars.example`); dashboard secrets are never downloaded
12
- - `canopy dev --local [--pull]` — offline sandbox with local data instead
13
- - `canopy deploy` — build and publish the frontend and the `worker/` backend
14
- - `AGENTS.md` — project guardrails and skill setup for coding agents
15
-
16
- Push-to-main deploys are prepared in `.github/workflows/canopy-deploy.yml`
17
- (needs a `CANOPY_DEPLOY_TOKEN` repo secret — see the workflow file).
@@ -1,5 +0,0 @@
1
- node_modules/
2
- dist/
3
- .canopy/
4
- .dev.vars
5
- .DS_Store
@@ -1,6 +0,0 @@
1
- {
2
- "slug": "{{slug}}",
3
- "build": "npm run build",
4
- "dist": "dist",
5
- "worker": "worker/index.ts"
6
- }
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{name}}</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.tsx"></script>
11
- </body>
12
- </html>
@@ -1,22 +0,0 @@
1
- {
2
- "name": "{{slug}}",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "dev": "canopy dev",
7
- "build": "tsc && vite build"
8
- },
9
- "dependencies": {
10
- "@mediamonks/canopy": "^0.0.4",
11
- "hono": "^4.8.0",
12
- "react": "^19.1.0",
13
- "react-dom": "^19.1.0"
14
- },
15
- "devDependencies": {
16
- "@types/react": "^19.1.0",
17
- "@types/react-dom": "^19.1.0",
18
- "@vitejs/plugin-react": "^5.0.0",
19
- "typescript": "^5.8.0",
20
- "vite": "^7.0.0"
21
- }
22
- }
@@ -1,25 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { canopy } from "./canopy.ts";
3
-
4
- export function App() {
5
- const [status, setStatus] = useState("connecting to Canopy…");
6
-
7
- useEffect(() => {
8
- canopy.auth
9
- .user()
10
- .then((user) => setStatus(`signed in as ${user.email}`))
11
- .catch(() => setStatus("could not reach Canopy — is `canopy dev` running?"));
12
- }, []);
13
-
14
- return (
15
- <main>
16
- <h1>{"{{name}}"}</h1>
17
- <p className="status">{status}</p>
18
- <section>
19
- <p className="placeholder">
20
- Start building — edit <code>src/app.tsx</code>, then run <code>canopy deploy</code>.
21
- </p>
22
- </section>
23
- </main>
24
- );
25
- }
@@ -1,5 +0,0 @@
1
- // One SDK instance for the whole app. Auth (auth), data (db), files (blob)
2
- // and AI (ai) are all live — see AGENTS.md for how to get the full reference.
3
- import { createCanopy } from "@mediamonks/canopy";
4
-
5
- export const canopy = createCanopy();
@@ -1,10 +0,0 @@
1
- import { StrictMode } from "react";
2
- import { createRoot } from "react-dom/client";
3
- import { App } from "./app.tsx";
4
- import "./style.css";
5
-
6
- createRoot(document.getElementById("root") as HTMLElement).render(
7
- <StrictMode>
8
- <App />
9
- </StrictMode>,
10
- );
@@ -1,29 +0,0 @@
1
- :root {
2
- font-family: system-ui, sans-serif;
3
- color-scheme: light dark;
4
- }
5
-
6
- body {
7
- margin: 0;
8
- display: grid;
9
- place-items: center;
10
- min-height: 100vh;
11
- }
12
-
13
- main {
14
- max-width: 40rem;
15
- padding: 2rem;
16
- text-align: center;
17
- }
18
-
19
- .status {
20
- font-size: 0.9rem;
21
- opacity: 0.7;
22
- }
23
-
24
- .placeholder {
25
- border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
26
- border-radius: 8px;
27
- padding: 1.5rem;
28
- opacity: 0.6;
29
- }
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "jsx": "react-jsx",
8
- "strict": true,
9
- "noEmit": true,
10
- "skipLibCheck": true,
11
- "isolatedModules": true,
12
- "allowImportingTsExtensions": true,
13
- "noUncheckedIndexedAccess": true
14
- },
15
- "include": ["src", "worker", "vite.config.ts"]
16
- }
@@ -1,7 +0,0 @@
1
- import react from "@vitejs/plugin-react";
2
- import { defineConfig } from "vite";
3
-
4
- // `canopy dev` picks this config up and adds its own /_api proxy on top.
5
- export default defineConfig({
6
- plugins: [react()],
7
- });
@@ -1,52 +0,0 @@
1
- /**
2
- * The project's own backend Worker (Hono-style handlers). It runs behind the
3
- * Canopy gateway — every request is already authenticated — and reaches the
4
- * platform (db/blob/ai) through the CANOPY service binding, so budgets and
5
- * data isolation still apply.
6
- *
7
- * On GCP, `canopy deploy` bundles this file and rolls a per-project Cloud Run
8
- * service (docs/05-gcp-plan.md G6). Routes under `/api/*` reach this Worker;
9
- * everything else serves the SPA. Dashboard schedules call `scheduled()`
10
- * (docs/07-schedules.md).
11
- */
12
-
13
- import { createCanopy } from "@mediamonks/canopy";
14
- import { Hono } from "hono";
15
-
16
- interface Env {
17
- // Service binding to the platform API (canopy-api), scoped to this project.
18
- CANOPY: { fetch: typeof fetch };
19
- // Dashboard secrets (Settings → Secrets) land as Workers-shaped bindings:
20
- // MY_API_KEY?: string;
21
- }
22
-
23
- interface ScheduledEvent {
24
- name: string;
25
- cron: string;
26
- scheduledTime: number;
27
- type: "scheduled";
28
- }
29
-
30
- const app = new Hono<{ Bindings: Env }>();
31
-
32
- // Routes under /api/* reach this Worker; everything else serves the SPA.
33
- app.get("/api/hello", async (c) => {
34
- const canopy = createCanopy({ fetch: c.env.CANOPY.fetch.bind(c.env.CANOPY) });
35
- const user = await canopy.auth.user();
36
- return c.json({ message: `Hello from the backend, ${user.name}!` });
37
- });
38
-
39
- export default {
40
- fetch: app.fetch.bind(app),
41
-
42
- // Settings → Schedules: switch on event.name (not the cron string).
43
- async scheduled(event: ScheduledEvent, _env: Env) {
44
- switch (event.name) {
45
- // case "daily-digest":
46
- // await doWork(_env);
47
- // break;
48
- default:
49
- console.warn("unhandled schedule", event.name);
50
- }
51
- },
52
- };