@somewhere-cloud/cli 0.38.153 → 0.38.155
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/CHANGELOG.md +11 -0
- package/dist/docs/adopt.md +39 -0
- package/dist/docs/analytics.md +161 -0
- package/dist/docs/api-reference.md +339 -0
- package/dist/docs/api-surface.md +2067 -0
- package/dist/docs/app-mcp.md +162 -0
- package/dist/docs/architecture-patterns.md +334 -0
- package/dist/docs/auth-client.md +531 -0
- package/dist/docs/billing.md +76 -0
- package/dist/docs/browser.md +639 -0
- package/dist/docs/calendar.md +298 -0
- package/dist/docs/changes.md +323 -0
- package/dist/docs/cli.md +407 -0
- package/dist/docs/common-mistakes.md +199 -0
- package/dist/docs/connect-agent.md +72 -0
- package/dist/docs/cors.md +114 -0
- package/dist/docs/cron.md +167 -0
- package/dist/docs/database-engine.md +167 -0
- package/dist/docs/declared-data.md +1656 -0
- package/dist/docs/declared-files.md +475 -0
- package/dist/docs/deploy-intelligence.md +188 -0
- package/dist/docs/deploy.md +733 -0
- package/dist/docs/design-system.md +273 -0
- package/dist/docs/dev-environments.md +496 -0
- package/dist/docs/domain-ownership.md +31 -0
- package/dist/docs/domains.md +370 -0
- package/dist/docs/feedback.md +88 -0
- package/dist/docs/file-tools.md +116 -0
- package/dist/docs/functions.md +489 -0
- package/dist/docs/getting-started.md +238 -0
- package/dist/docs/github.md +95 -0
- package/dist/docs/google-calendar.md +212 -0
- package/dist/docs/groups.md +836 -0
- package/dist/docs/guarantees.md +58 -0
- package/dist/docs/handled-for-you.md +224 -0
- package/dist/docs/inspect.md +171 -0
- package/dist/docs/limits.md +68 -0
- package/dist/docs/live-data.md +197 -0
- package/dist/docs/live.md +92 -0
- package/dist/docs/local-dev.md +30 -0
- package/dist/docs/migration-supabase.md +58 -0
- package/dist/docs/payments.md +1102 -0
- package/dist/docs/portability.md +194 -0
- package/dist/docs/postgres.md +301 -0
- package/dist/docs/pricing-comparison.md +42 -0
- package/dist/docs/pricing.md +39 -0
- package/dist/docs/project-groups.md +107 -0
- package/dist/docs/projects.md +380 -0
- package/dist/docs/recipe-ai-agent.md +112 -0
- package/dist/docs/recipe-ai-features.md +227 -0
- package/dist/docs/recipe-ai-receipts.md +783 -0
- package/dist/docs/recipe-background-jobs.md +369 -0
- package/dist/docs/recipe-booking.md +348 -0
- package/dist/docs/recipe-csv-import.md +390 -0
- package/dist/docs/recipe-ecommerce.md +127 -0
- package/dist/docs/recipe-email.md +282 -0
- package/dist/docs/recipe-escalation.md +133 -0
- package/dist/docs/recipe-file-uploads.md +159 -0
- package/dist/docs/recipe-import-app.md +110 -0
- package/dist/docs/recipe-login.md +457 -0
- package/dist/docs/recipe-multi-chat.md +198 -0
- package/dist/docs/recipe-paid-api.md +161 -0
- package/dist/docs/recipe-pdfs.md +205 -0
- package/dist/docs/recipe-push-notifications.md +107 -0
- package/dist/docs/recipe-seo.md +200 -0
- package/dist/docs/recipe-signed-in-app.md +330 -0
- package/dist/docs/render.md +99 -0
- package/dist/docs/rooms.md +554 -0
- package/dist/docs/sdk.md +287 -0
- package/dist/docs/sdks.md +24 -0
- package/dist/docs/search.md +199 -0
- package/dist/docs/security-model.md +168 -0
- package/dist/docs/setup.md +212 -0
- package/dist/docs/smoke.md +102 -0
- package/dist/docs/speed.md +298 -0
- package/dist/docs/sql-compatibility.md +96 -0
- package/dist/docs/sw.agent.md +248 -0
- package/dist/docs/sw.ai.md +1291 -0
- package/dist/docs/sw.auth.md +1811 -0
- package/dist/docs/sw.billing.md +171 -0
- package/dist/docs/sw.db.md +2128 -0
- package/dist/docs/sw.email.md +661 -0
- package/dist/docs/sw.endpoint.md +187 -0
- package/dist/docs/sw.env.md +303 -0
- package/dist/docs/sw.fetch.md +115 -0
- package/dist/docs/sw.fs.md +424 -0
- package/dist/docs/sw.groups.md +836 -0
- package/dist/docs/sw.image.md +69 -0
- package/dist/docs/sw.jobs.md +520 -0
- package/dist/docs/sw.logs.md +61 -0
- package/dist/docs/sw.mail.md +106 -0
- package/dist/docs/sw.notifications.md +78 -0
- package/dist/docs/sw.push.md +161 -0
- package/dist/docs/sw.rateLimit.md +67 -0
- package/dist/docs/sw.web.md +128 -0
- package/dist/docs/tasks.md +269 -0
- package/dist/docs/test.md +220 -0
- package/dist/docs/tool-reference-account.md +7 -0
- package/dist/docs/tool-reference-ai.md +121 -0
- package/dist/docs/tool-reference-analytics.md +37 -0
- package/dist/docs/tool-reference-api.md +19 -0
- package/dist/docs/tool-reference-artifacts.md +35 -0
- package/dist/docs/tool-reference-auth.md +163 -0
- package/dist/docs/tool-reference-browser.md +114 -0
- package/dist/docs/tool-reference-code.md +26 -0
- package/dist/docs/tool-reference-connect.md +21 -0
- package/dist/docs/tool-reference-cron.md +48 -0
- package/dist/docs/tool-reference-db.md +282 -0
- package/dist/docs/tool-reference-domains.md +107 -0
- package/dist/docs/tool-reference-email.md +55 -0
- package/dist/docs/tool-reference-env.md +19 -0
- package/dist/docs/tool-reference-feedback.md +56 -0
- package/dist/docs/tool-reference-fs.md +265 -0
- package/dist/docs/tool-reference-github.md +57 -0
- package/dist/docs/tool-reference-groups.md +85 -0
- package/dist/docs/tool-reference-help.md +29 -0
- package/dist/docs/tool-reference-jobs.md +39 -0
- package/dist/docs/tool-reference-live.md +48 -0
- package/dist/docs/tool-reference-logs.md +16 -0
- package/dist/docs/tool-reference-payments.md +44 -0
- package/dist/docs/tool-reference-project.md +706 -0
- package/dist/docs/tool-reference-push.md +78 -0
- package/dist/docs/tool-reference-rate-limit.md +18 -0
- package/dist/docs/tool-reference-search.md +68 -0
- package/dist/docs/tool-reference-security.md +42 -0
- package/dist/docs/tool-reference-smoke.md +17 -0
- package/dist/docs/tool-reference-stock-photos.md +20 -0
- package/dist/docs/tool-reference-tasks.md +73 -0
- package/dist/docs/tool-reference-telegram.md +32 -0
- package/dist/docs/tool-reference-usage.md +9 -0
- package/dist/docs/tool-reference-web.md +71 -0
- package/dist/docs/tool-reference-webhooks.md +9 -0
- package/dist/docs/troubleshooting.md +411 -0
- package/dist/docs/typed-functions.md +94 -0
- package/dist/docs/verify-before-deploy.md +67 -0
- package/dist/docs/vs-supabase.md +75 -0
- package/dist/docs/vs-vercel.md +103 -0
- package/dist/lib/bundle.js +303 -221
- package/dist/lib/bundle.js.map +3 -3
- package/dist/types/lib/test-session.d.ts +8 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -2
- package/runtime/DECLARED-DATA-VENDOR.json +5 -5
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/SOURCE-LINT-VENDOR.json +2 -2
- package/runtime/declared-data.cjs +37 -19
- package/runtime/source-lint.cjs +1 -1
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
# Deploy and domains
|
|
2
|
+
|
|
3
|
+
You deploy raw source. The platform compiles your React and TypeScript, bundles
|
|
4
|
+
the npm packages in `package.json`, applies `db/schema.ts`, runs its deploy
|
|
5
|
+
checks, and serves the new release at your project's address. There's no
|
|
6
|
+
build step and no `dist` folder. Every deploy is a numbered version you can
|
|
7
|
+
inspect. Every plan rolls back to the previous working version. Restoring a
|
|
8
|
+
chosen retained version is on paid plans; history listing and retention are
|
|
9
|
+
described separately below.
|
|
10
|
+
|
|
11
|
+
The CLI shows an app-role grant command after deployment when a manually assigned app-wide role has no holder. Sign in to the deployed app before granting the role. `project_deploy` and `somewhere deploy --json` return the same facts in `unassigned_app_roles`: the `role`, the `command`, and the `sign_in_url` when the app declares it. Roles held by verified email domain or assigned by the server have their own assignment rules. See `somewhere docs adopt` for owner setup and schedule verification.
|
|
12
|
+
|
|
13
|
+
## Deploy and check the result
|
|
14
|
+
|
|
15
|
+
Ask before destructive or paid actions unless the user already authorized them.
|
|
16
|
+
|
|
17
|
+
For an existing app, start with `somewhere pull <app>` in a fresh folder,
|
|
18
|
+
then edit the downloaded source. In a connector, read from `project_export`
|
|
19
|
+
first and update selected files with `project_patch`.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
somewhere deploy # publishes and prints the live URL
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When the project has a `tsconfig.json` and its dependencies are installed,
|
|
26
|
+
`somewhere deploy` checks types locally and stops before uploading if it finds
|
|
27
|
+
errors. If dependencies are missing, deploy skips the local typecheck and
|
|
28
|
+
the platform compiles the source. `somewhere deploy-check` compiles without
|
|
29
|
+
publishing.
|
|
30
|
+
|
|
31
|
+
Run `somewhere claim` and open its link to keep a temporary app.
|
|
32
|
+
|
|
33
|
+
Over MCP, `project_deploy` and `project_patch` run the same pipeline
|
|
34
|
+
(below).
|
|
35
|
+
|
|
36
|
+
To deploy a folder over HTTP, send its tar.gz as the multipart `source`
|
|
37
|
+
field to `POST /v1/deploy`. See [the curl example](https://somewhere.cloud/auth.md).
|
|
38
|
+
|
|
39
|
+
**A redeploy over HTTP names the live release it was prepared from.** Send
|
|
40
|
+
`base_release_id`: the `release_id` from the last deploy response, or the
|
|
41
|
+
live version's id from a project read. A project with no source yet takes
|
|
42
|
+
`base_release_id: null`. Without it the deploy is refused with
|
|
43
|
+
`BASE_REQUIRED` and nothing changes; if live moved since, it is refused with
|
|
44
|
+
`STALE_RELEASE_BASE`. This stops one deploy from silently overwriting another
|
|
45
|
+
writer's. `force: true` is the deliberate overwrite.
|
|
46
|
+
|
|
47
|
+
A clone with `.somewhere.json` keeps its link to the original project. Use
|
|
48
|
+
`somewhere deploy --new` to publish a separate copy and update the clone's
|
|
49
|
+
link.
|
|
50
|
+
|
|
51
|
+
`somewhere deploy` from the project folder is a full deploy:
|
|
52
|
+
|
|
53
|
+
- **Static files are replaced.** A file that isn't in the folder is removed
|
|
54
|
+
from the live site.
|
|
55
|
+
- **Functions are replaced too.** A function file that isn't in the folder is
|
|
56
|
+
deleted. `--scope functions` deploys only functions and keeps the ones you
|
|
57
|
+
left out, unless you add `--replace-functions`. `--scope static` leaves
|
|
58
|
+
functions untouched.
|
|
59
|
+
- **MCP and JSON deploys keep omitted functions by default.** `project_deploy`
|
|
60
|
+
replaces static files but keeps a function you didn't send, and names it in
|
|
61
|
+
a warning. Pass `replace_functions: true` to drop it. For a single-file
|
|
62
|
+
change, use `project_patch` instead of resending everything.
|
|
63
|
+
- **A tar.gz upload replaces files and functions.** Send the complete source
|
|
64
|
+
folder.
|
|
65
|
+
- **Promoting a preview keeps production functions by default.**
|
|
66
|
+
`somewhere promote <preview_session_id> <preview_id> --yes` leaves live a
|
|
67
|
+
production function the preview lacks and names it; `--prune` removes it
|
|
68
|
+
(`dev-environments`). A plain `somewhere deploy` removes it. The output
|
|
69
|
+
of both names each function it removed or kept.
|
|
70
|
+
- **`db/schema.ts` is applied before the new version goes live.** If a deploy
|
|
71
|
+
is refused after that step, the schema changes it made stay in the database
|
|
72
|
+
while the previous version keeps serving. Before deploying again, read the
|
|
73
|
+
live schema with `somewhere call db_describe '{"project_id":"<project>"}'`
|
|
74
|
+
and make the next deploy match it.
|
|
75
|
+
|
|
76
|
+
To publish and run a saved journey in one command, use
|
|
77
|
+
`somewhere deploy --verify flows/journey.json`. Keep the flow file out of
|
|
78
|
+
the deployed source with `.somewhereignore` when it contains test credentials.
|
|
79
|
+
|
|
80
|
+
The deploy response carries the build log: the detected entry, bundle sizes
|
|
81
|
+
and warnings. A refusal names the file and the reason; no new version goes
|
|
82
|
+
live. Schema changes already applied stay in place (see below).
|
|
83
|
+
|
|
84
|
+
**When you can't tell whether a deploy finished**, for example because the
|
|
85
|
+
command was interrupted, look before deploying again. `somewhere call project_deploys '{"project_id":"<project>"}'` lists
|
|
86
|
+
recent versions, and `deploy_status` names the live release. Deploy again
|
|
87
|
+
only once you've confirmed your version isn't there and nothing is still in
|
|
88
|
+
progress.
|
|
89
|
+
|
|
90
|
+
**To undo a bad deploy**, run `somewhere rollback --yes` on any plan. It
|
|
91
|
+
restores the previous working version, including its functions (see
|
|
92
|
+
`rollback` below).
|
|
93
|
+
|
|
94
|
+
**After a deploy**, `somewhere errors` lists recent runtime and API errors,
|
|
95
|
+
and `somewhere logs` shows your functions' log lines (how long they are kept:
|
|
96
|
+
`sw.logs` → `retention`).
|
|
97
|
+
|
|
98
|
+
## Version notes
|
|
99
|
+
|
|
100
|
+
Give a production version an optional `message` when deploying, patching or
|
|
101
|
+
promoting. `project_deploy` and `project_patch` accept it; the CLI uses
|
|
102
|
+
`somewhere deploy -m "Change the heading"` and `somewhere promote <preview_session_id> <preview_id> --yes -m "Ready to share"`.
|
|
103
|
+
The HTTP deploy, patch and promote calls take the same field. Promotion remains
|
|
104
|
+
on full MCP, CLI and HTTP.
|
|
105
|
+
|
|
106
|
+
Notes are plain text, at most 200 Unicode characters after control and
|
|
107
|
+
direction-changing characters are removed. Line breaks become spaces.
|
|
108
|
+
Overlong or non-text input is refused. Empty notes are omitted.
|
|
109
|
+
The note stays on the release record; `project_deploys` shows it as `message`
|
|
110
|
+
with `message_kind: "user_supplied_note"`. Displays keep the note as text.
|
|
111
|
+
An unchanged deploy or a replay keeps the original version's note.
|
|
112
|
+
Change a note with `somewhere deploys note 3 "Keep this version"`,
|
|
113
|
+
`project_patch({ project_id, note_version: 3, message: "Keep this version" })`,
|
|
114
|
+
or `PATCH /v1/deploy/note` with `{ project_id, version: 3, message }`.
|
|
115
|
+
Changing a note requires editor access and takes effect in history without a deploy.
|
|
116
|
+
|
|
117
|
+
## Rollback
|
|
118
|
+
|
|
119
|
+
`somewhere rollback --yes` (MCP `project_rollback`) makes the previous working
|
|
120
|
+
version live again on every plan, and visitors see it immediately. That is
|
|
121
|
+
the version that was live just before the current one; a deploy that failed
|
|
122
|
+
never went live, so it never counts. Rolling back again returns to the version
|
|
123
|
+
the rollback replaced. `somewhere deploys` and `project_deploys` show each
|
|
124
|
+
version, time, note and restore call when available. Use
|
|
125
|
+
`somewhere restore 3 --yes`, `project_rollback({ project_id, version: 3 })`,
|
|
126
|
+
or `POST /v1/promote/restore` with `{ project_id, version: 3 }` to make
|
|
127
|
+
version 3 live again. Free projects can restore any retained deploy from the last 24 hours by number or roll back to the previous working version. Paid plans can restore any retained version.
|
|
128
|
+
|
|
129
|
+
To get one file from version 2, run `somewhere file index.html --version 2 > restored-index.html`
|
|
130
|
+
or call `project_file_read({ project_id, path: "index.html", version: 2 })`.
|
|
131
|
+
HTTP uses `GET /v1/deploy/file?project_id=...&path=index.html&version=2`.
|
|
132
|
+
This reads stored production source. Deploy the file to make your edit live.
|
|
133
|
+
Kept versions can still contain secrets removed from later source.
|
|
134
|
+
|
|
135
|
+
Retention has three distinct parts:
|
|
136
|
+
- **Source history policy:** Free keeps the latest 10 snapshots and every snapshot from the last 24 hours.
|
|
137
|
+
Paid plans keep the latest 50 plus daily representatives for
|
|
138
|
+
90 days. Release source follows a separate
|
|
139
|
+
policy. To confirm that a version's source is still available, read a file
|
|
140
|
+
from that version.
|
|
141
|
+
- **Release history rows:** `project_deploys` returns up to 150 successful releases
|
|
142
|
+
plus 20 failed attempts, interleaved by time. That is a listing cap, not a source
|
|
143
|
+
retention window or all retained history. `somewhere status` reports current
|
|
144
|
+
project, deployment and workspace status; use `somewhere deploys`
|
|
145
|
+
for history. Platform changes are attributed to Somewhere.
|
|
146
|
+
- **Compiled builds:** the latest six function builds plus the active and previous
|
|
147
|
+
activation are kept. Free also keeps builds from the last 24 hours. A restore
|
|
148
|
+
leaves the deploy time unchanged. `rollback_available` describes build availability, not source
|
|
149
|
+
availability or a guarantee of schema-safe restoration.
|
|
150
|
+
|
|
151
|
+
Rolling back and restoring check that the earlier version's schema is safe for
|
|
152
|
+
the current database and refuse with the schema plan when it is not.
|
|
153
|
+
By default this changes code without restoring data. Restoring by number
|
|
154
|
+
leaves the database schema and data unchanged. Tables and columns a later
|
|
155
|
+
version added stay, with their data, and the earlier version ignores them.
|
|
156
|
+
The response says so in `database_notice` and its message. For a rollback
|
|
157
|
+
to the previous version, `project_rollback` with `with_schema: true` also
|
|
158
|
+
applies the earlier schema through deployment checks and can affect data.
|
|
159
|
+
|
|
160
|
+
## Before you change a project you didn't just deploy
|
|
161
|
+
|
|
162
|
+
Read the live state first. `project_get` gives the current version.
|
|
163
|
+
`somewhere pull` (MCP `project_export`) fetches the deployed source.
|
|
164
|
+
|
|
165
|
+
**When a deploy is refused because live is newer than the folder**
|
|
166
|
+
(`STALE_RELEASE_BASE`), the message names the live version, what put it
|
|
167
|
+
there (the CLI, an agent through the connector, the dashboard, GitHub, a
|
|
168
|
+
rollback or restore, or this folder's own `somewhere rollback --yes`/`restore`), and
|
|
169
|
+
the files that differ. Run `somewhere pull`, then deploy again. In a linked
|
|
170
|
+
folder, plain `pull` is the safe update: files you have not edited move to
|
|
171
|
+
live, your local edits and local-only files (AGENTS.md, notes, tests) stay,
|
|
172
|
+
and it stops without writing anything if a file changed both in the folder
|
|
173
|
+
and live. `pull --force` replaces your edits with live; it never deletes a
|
|
174
|
+
file a deploy would not upload.
|
|
175
|
+
`project_deploys` lists recent versions, so you can see whether someone else
|
|
176
|
+
is shipping. Recent runtime failures are in `somewhere errors`.
|
|
177
|
+
|
|
178
|
+
## Connect a domain
|
|
179
|
+
|
|
180
|
+
For dashboard steps, see [Custom Domains](https://somewhere.cloud/docs/domains.txt).
|
|
181
|
+
|
|
182
|
+
A domain you already own is connected by claiming it. Delegate its
|
|
183
|
+
nameservers once, then attach it to any project. Claiming moves the domain's
|
|
184
|
+
DNS to the platform. The new zone doesn't import your existing records, and
|
|
185
|
+
it adds mail (MX) records only if you turn on receiving mail. If the domain
|
|
186
|
+
already receives email or serves other records, use the DNS-record path
|
|
187
|
+
below instead, which keeps your nameservers and records where they are. These are MCP tools; from
|
|
188
|
+
the CLI, call them with `somewhere call <tool> '<json>'`:
|
|
189
|
+
|
|
190
|
+
1. `domain_claim({ domain: "example.com" })` returns two nameservers.
|
|
191
|
+
2. The owner sets those nameservers at their registrar.
|
|
192
|
+
3. `domain_check_ns({ id })` reports `claim_status: "active"` once
|
|
193
|
+
delegation has propagated. The platform also checks on its own.
|
|
194
|
+
4. `domain_attach({ id, project_id, host: "apex" })` serves the project
|
|
195
|
+
there. `host` can also be `"www"` or a subdomain label.
|
|
196
|
+
|
|
197
|
+
The claim belongs to the owner's account, not to one project. Moving the
|
|
198
|
+
domain to another project is `domain_detach` then `domain_attach`, with no
|
|
199
|
+
new verification.
|
|
200
|
+
|
|
201
|
+
Connecting a domain never changes who owns it: it stays registered to the
|
|
202
|
+
owner at their registrar. On the DNS-record path,
|
|
203
|
+
`domain_add` gives a CNAME and a verification TXT record for a single
|
|
204
|
+
hostname, and `domain_verify` checks them. A bare domain (example.com itself)
|
|
205
|
+
works only by claiming it, or by connecting www and forwarding the bare name
|
|
206
|
+
to www at the DNS company.
|
|
207
|
+
|
|
208
|
+
**Buying a domain is the owner's payment.** `domain_buy` returns a price and
|
|
209
|
+
a checkout link. The owner opens the link and pays, and registration begins
|
|
210
|
+
only after payment settles. An agent can't complete the purchase. A bought
|
|
211
|
+
domain is registered in the buyer's name.
|
|
212
|
+
|
|
213
|
+
## More on deploy and domains
|
|
214
|
+
|
|
215
|
+
| Need | Where |
|
|
216
|
+
|---|---|
|
|
217
|
+
| Full and partial deploys, function preservation, build log | `deploy` → `projectdeploy-replaces-files-preserves-omitted-functions-by-default` |
|
|
218
|
+
| Single-file patches | `deploy` → `projectpatch-incremental` |
|
|
219
|
+
| Dependencies and lockfiles | `deploy` → `dependencies-and-lockfiles` |
|
|
220
|
+
| Checks before deploying | `deploy` → `check-before-you-deploy-no-deploy-required`; `verify-before-deploy` |
|
|
221
|
+
| What runs after a deploy (screenshots, reviews) | `deploy` → `after-every-deploy-the-platform-automatically`; `deploy-intelligence` |
|
|
222
|
+
| Rollback and versions | `deploy` → `rollback`; `inspect` |
|
|
223
|
+
| Previews before production | `dev-environments` |
|
|
224
|
+
| Domain claim, DNS-record path, recovery | `domains` → `recommended-claim-by-delegating-nameservers`, `dns-record-setup`, `stuck-domain-recovery` |
|
|
225
|
+
| Buying a domain, ownership | `domains` → `buy-a-domain-through-checkout`; `domain-ownership` |
|
|
226
|
+
|
|
227
|
+
## Previews and deploy size limits
|
|
228
|
+
|
|
229
|
+
Deploys go straight to production. On every plan, an app with
|
|
230
|
+
real users can instead deploy to an isolated preview and promote it when
|
|
231
|
+
ready → docs({ topic: 'dev-environments' }). The size limits for one deploy
|
|
232
|
+
are in the table at the end of this topic: `deploy-size-limits`.
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
## Deployed SEO metadata
|
|
236
|
+
|
|
237
|
+
See `recipe-seo` → `deployed-seo-metadata` for the check's fields,
|
|
238
|
+
release identity and inspection limits.
|
|
239
|
+
|
|
240
|
+
## Optional analytics consent
|
|
241
|
+
|
|
242
|
+
The platform adds no analytics beacon or third-party analytics loader to your
|
|
243
|
+
pages. Aggregate pageviews are collected on the server. When optional consent
|
|
244
|
+
mode is off, existing platform pageview and event collection continues.
|
|
245
|
+
|
|
246
|
+
Set `analytics_consent: { mode: "required", policy_version: "v1" }` through
|
|
247
|
+
`project_update` or `PATCH /v1/projects/:id`; `project_get` shows the
|
|
248
|
+
policy. Versions use 1–64 letters, numbers, dots, underscores or hyphens.
|
|
249
|
+
The "Require analytics consent" mode adds a neutral same-origin UI with equal Accept/Reject controls
|
|
250
|
+
and a change/revoke control. It blocks the two platform collectors until a
|
|
251
|
+
matching acceptance; a version change requires a new choice. A restrictive
|
|
252
|
+
app CSP may block the UI; without matching acceptance collection stays
|
|
253
|
+
blocked. CSP is never loosened.
|
|
254
|
+
|
|
255
|
+
`GET /__sw/analytics-consent` returns `{ policy, state }` on the actual
|
|
256
|
+
project host: enabled, pending, declined or unavailable.
|
|
257
|
+
Same-origin `POST` with JSON `{ action: "accept" | "deny" | "revoke",
|
|
258
|
+
policy_version: "v1" }` requires the exact Origin. Responses are no-store.
|
|
259
|
+
Choice is remembered for 90 days in a Secure, HttpOnly, host-only cookie;
|
|
260
|
+
no visitor identifier or event history is added. Revoke stores denial and
|
|
261
|
+
blocks future requests; it does not cancel every in-flight event. There is no
|
|
262
|
+
pre-consent queue, replay or backfill.
|
|
263
|
+
|
|
264
|
+
Required-mode background and developer/MCP calls without an original browser
|
|
265
|
+
choice return `recorded: false` with consent_pending, consent_declined or
|
|
266
|
+
consent_unavailable. Runtime uses the original request; body/options and
|
|
267
|
+
non-runtime headers cannot replace that choice. Ingestion checks current
|
|
268
|
+
policy again. Existing function bundles need a new deploy to gain runtime
|
|
269
|
+
preflight and request-choice forwarding; older bundles may still send a
|
|
270
|
+
request, which ingestion blocks in required mode. After that upgrade, policy
|
|
271
|
+
changes do not need another deploy. Auth, security logs and bandwidth
|
|
272
|
+
accounting continue.
|
|
273
|
+
Coverage is platform pageviews and `sw.analytics.track`; arbitrary app or
|
|
274
|
+
third-party trackers need separate adapters. No whole-site or legal
|
|
275
|
+
compliance claim is made.
|
|
276
|
+
|
|
277
|
+
## Dependencies and lockfiles
|
|
278
|
+
|
|
279
|
+
Declare dependencies in `package.json`; the platform installs and bundles
|
|
280
|
+
them on deploy. You never run `npm install` and never upload `node_modules`.
|
|
281
|
+
|
|
282
|
+
- **With a lockfile** — `package-lock.json` (lockfile version 2 or 3) or
|
|
283
|
+
`npm-shrinkwrap.json`, which wins when both are present — the deploy uses
|
|
284
|
+
exactly the versions and integrity hashes the lock selects for the selected
|
|
285
|
+
packages: every declared runtime dependency (only platform-provided compile
|
|
286
|
+
tooling is excepted; runtime dependencies are not tree-shaken before lock
|
|
287
|
+
selection), plus dev dependencies your source actually imports and declared
|
|
288
|
+
`@types` packages, and their required transitive closure. Supported lock
|
|
289
|
+
entries are exact packages from
|
|
290
|
+
the public npm registry with integrity. A lock the platform cannot honour
|
|
291
|
+
is refused with `DEPENDENCY_LOCK_INVALID` and there is no unlocked
|
|
292
|
+
fallback: aliases, linked, workspace, file or git packages, custom
|
|
293
|
+
registries, version-1 or malformed locks, and locks whose selected graph is
|
|
294
|
+
incomplete or inconsistent all refuse.
|
|
295
|
+
- **Without a lockfile** — ranges in `package.json` resolve at deploy. This
|
|
296
|
+
is supported, but it is not verified reproducible: two deploys of the same
|
|
297
|
+
source can pick different versions. Ship a lock when that matters.
|
|
298
|
+
- **What a lock does not promise** — unused dev and tooling entries are not
|
|
299
|
+
installed, and the platform's own build tooling is pinned separately.
|
|
300
|
+
Pre-installed common packages are reused only when they match your lock's
|
|
301
|
+
full dependency graph and integrity; otherwise the deploy installs fresh.
|
|
302
|
+
When the current compiler compiles your source, the release records the
|
|
303
|
+
package versions and dependency relationships selected or bundled for that
|
|
304
|
+
compilation and binds that record to the release; a release never
|
|
305
|
+
re-resolves. A static release, or a release served from an accepted
|
|
306
|
+
earlier build, may carry no new compilation record. Without a supported
|
|
307
|
+
lockfile the record is observational — versions, manifest hashes and
|
|
308
|
+
relationships as resolved, with any dependency target it could not resolve
|
|
309
|
+
left explicitly unresolved — and it does not claim a lock-verified
|
|
310
|
+
dependency graph. It covers what that compilation selected or bundled, not
|
|
311
|
+
packages your code loads dynamically at runtime, not the platform's own
|
|
312
|
+
tooling, and it is not an assertion that every installed file byte was
|
|
313
|
+
independently verified or that every dependency runs correctly.
|
|
314
|
+
|
|
315
|
+
## Developer-file protection + .somewhereignore
|
|
316
|
+
|
|
317
|
+
Deploys never accidentally publish local/dev/control files. The platform
|
|
318
|
+
strips these from the static payload on EVERY deploy path (CLI, MCP
|
|
319
|
+
`project_deploy`, REST, GitHub import) and lists each exclusion in the
|
|
320
|
+
deploy warnings: root `README.md`, `CLAUDE.md`, `AGENTS.md`,
|
|
321
|
+
`AGENT.md`, `.env` / `.env.*` / `.envrc` / `.npmrc`,
|
|
322
|
+
`.git*` metadata, `.somewhere.json`, `.mcp.json`, ignore files
|
|
323
|
+
themselves, editor/system dirs (`.claude/`, `.cursor/`, `.vscode/`,
|
|
324
|
+
`.idea/`, `.wrangler/`), `node_modules/`, and `.DS_Store` /
|
|
325
|
+
`Thumbs.db` anywhere. `package.json`, tsconfigs, and vite configs still
|
|
326
|
+
ship — the platform compiles from them.
|
|
327
|
+
|
|
328
|
+
To publish a root design file, run `somewhere deploy --include DESIGN.md`.
|
|
329
|
+
Use `.somewhereignore` or `.gitignore` to exclude files from CLI deploys. Both
|
|
330
|
+
use gitignore syntax.
|
|
331
|
+
|
|
332
|
+
## Reliability guarantees on every deploy
|
|
333
|
+
|
|
334
|
+
- **After-deploy check.** Right after every live deploy, the platform loads
|
|
335
|
+
your home page in a browser, signed out and as a test user, on a computer
|
|
336
|
+
and a phone, and probes the app's data access. A page that comes up blank,
|
|
337
|
+
or throws while loading, is warned about, not rolled back: the deploy stays
|
|
338
|
+
live. `project_deploy_log({ project_id })` (REST
|
|
339
|
+
`GET /v1/deploy/log?project_id=…`) returns the result under `access_check`
|
|
340
|
+
once the check finishes. When the version live before it worked, the
|
|
341
|
+
sentence starts with the warning and the way back, and
|
|
342
|
+
`access_check.go_back` carries it: `previous_version`, `cli`
|
|
343
|
+
(`somewhere restore <version> --project <project_id> --yes`), `mcp`
|
|
344
|
+
(`project_rollback({ project_id, version })`) and `http`
|
|
345
|
+
(`POST /v1/promote/restore { project_id, version }`). The project overview
|
|
346
|
+
(`GET /v1/projects/<id>/overview`) shows the same as `needs_a_look`. A
|
|
347
|
+
deploy that fixes the cause also replaces it. The check's own requests and
|
|
348
|
+
the deploy screenshot are never counted as the app's visits, requests or
|
|
349
|
+
errors. Server code that fails to start is refused before anything goes
|
|
350
|
+
live.
|
|
351
|
+
- **Version history + rollback.** Every deploy writes a versioned
|
|
352
|
+
snapshot. On every plan, `project_rollback` returns to the previous working version.
|
|
353
|
+
Free can restore a retained deploy from the last 24 hours by number. Paid plans can restore any retained version.
|
|
354
|
+
The platform evaluates managed-schema rollback safety before activation and
|
|
355
|
+
refuses restoration when the prior schema is unsafe; inspect the returned schema plan.
|
|
356
|
+
A version that can never return as it is refuses with `409` and nothing
|
|
357
|
+
changes: one built with the project's older configuration format
|
|
358
|
+
(`HOT_CONFIG_LEGACY_RELEASE`) or across an access-rule change; a new deploy
|
|
359
|
+
of that version's source puts it back.
|
|
360
|
+
- **Continuous code review.** Deterministic security checks run during
|
|
361
|
+
compilation on every tier. Every plan can request a review. Paid plans get a longer report.
|
|
362
|
+
Eligible paid plans also review when a preview is promoted.
|
|
363
|
+
Run `security_review` to get a report for the deployed code.
|
|
364
|
+
|
|
365
|
+
Full reference: <https://somewhere.cloud/docs/llms.txt>.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
**Ship raw source. The platform compiles JSX/TSX/TS automatically — for
|
|
370
|
+
both the frontend AND the backend.** `/v1/deploy` compiles
|
|
371
|
+
your sources at deploy time:
|
|
372
|
+
|
|
373
|
+
- Frontend: `.jsx` / `.tsx` / `.css` are bundled into hashed chunks
|
|
374
|
+
under `/_compiled/`, and `index.html` is rewritten to point at them.
|
|
375
|
+
- Functions: each `api/*.ts` (or `.tsx`, `.js`) is compiled to JS the
|
|
376
|
+
runtime can execute — no client-side `tsc`, no `esbuild api/chat.ts`,
|
|
377
|
+
no pre-bundled `.mjs`. You ship the same files you write.
|
|
378
|
+
|
|
379
|
+
Do not run `npm run build`, `vite build`, `esbuild`, `tsc`, or
|
|
380
|
+
similar first. `/v1/deploy` still accepts pre-bundled output but returns a
|
|
381
|
+
warning (the deploy is not blocked), and bundled files lose cross-function
|
|
382
|
+
imports and source round-trips. This includes pre-bundled `api/*.mjs`
|
|
383
|
+
functions, not just `dist/` static output. To accept the trade-off and drop the
|
|
384
|
+
warning: `somewhere deploy --prebuilt`, the project setting, or `allow_bundled: true`.
|
|
385
|
+
|
|
386
|
+
### Put large binary assets in file storage
|
|
387
|
+
|
|
388
|
+
Deploy trees are for code. Large binary assets such as images, fonts,
|
|
389
|
+
and video belong in file storage: upload them with `fs_upload` and
|
|
390
|
+
`public: true`, then call `fs_public_url` and reference the returned
|
|
391
|
+
URL from your app. `fs_write` is for text and small inline content, not
|
|
392
|
+
real binary files. Assets in the deploy tree are re-processed on every
|
|
393
|
+
release, so a big asset folder makes every deploy slower and can fail
|
|
394
|
+
the deploy outright.
|
|
395
|
+
|
|
396
|
+
```text
|
|
397
|
+
fs_upload({
|
|
398
|
+
project_id: "my-app", path: "/assets/badge.png",
|
|
399
|
+
file: attachedFile, public: true
|
|
400
|
+
})
|
|
401
|
+
fs_public_url({ project_id: "my-app", path: "/assets/badge.png" })
|
|
402
|
+
// Put the returned public_url in <img src="…"> or CSS.
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Why the functions side matters: pre-bundling your functions yourself
|
|
406
|
+
defeats the read-source-back features (export, find/replace, the visual
|
|
407
|
+
editor) and often fails at runtime. Ship the `.ts` source and the
|
|
408
|
+
platform compiles it — cross-imports resolve correctly.
|
|
409
|
+
|
|
410
|
+
Escape hatch (specialized prebuilt pipeline, native binary, etc):
|
|
411
|
+
- CLI, one-off: `somewhere deploy --prebuilt`.
|
|
412
|
+
- REST/MCP equivalent: pass `{ allow_bundled: true }` in the deploy
|
|
413
|
+
body.
|
|
414
|
+
|
|
415
|
+
Two ways to ship code (the MCP tools — CLI maps onto the same pipeline):
|
|
416
|
+
|
|
417
|
+
project_deploy — replaces static files (omitted files deleted), preserves omitted functions unless replace_functions:true; use for the initial deploy or a major rebuild
|
|
418
|
+
project_patch — incremental, use for small edits, single-file changes, adding one endpoint
|
|
419
|
+
|
|
420
|
+
**Deploys go live immediately by default.** A normal `project_deploy`
|
|
421
|
+
or `project_patch` writes the live serving slot in one step — the
|
|
422
|
+
result is instantly at `https://{subdomain}.somewhere.site` and on any
|
|
423
|
+
verified custom domain. No extra step to publish.
|
|
424
|
+
|
|
425
|
+
## Start from a template
|
|
426
|
+
|
|
427
|
+
Templates are ready-made apps the platform stores and deploys. List them
|
|
428
|
+
(no key needed):
|
|
429
|
+
|
|
430
|
+
GET /v1/templates
|
|
431
|
+
// → { templates: [{ name, title, description, edit }] }
|
|
432
|
+
|
|
433
|
+
Deploy one in one call, signed in or on a temporary account:
|
|
434
|
+
|
|
435
|
+
POST /v1/deploy { "template": "links", "name": "My links" }
|
|
436
|
+
// → the usual deploy answer with project_id and url
|
|
437
|
+
// (and claim_url on a temporary account)
|
|
438
|
+
|
|
439
|
+
The call creates the project if the name is new and publishes the
|
|
440
|
+
template. Repeating it is safe: when that app is already published it
|
|
441
|
+
answers `already_existed: true` with the same `project_id` and `url`, and
|
|
442
|
+
changes nothing. A template's `words` are the few pieces of text written in
|
|
443
|
+
its `index.html` (for `links`, the name and the line under it); `edit` names
|
|
444
|
+
the file that holds everything else (for `links`, `src/links.json`: the
|
|
445
|
+
photo, the theme and the links). Change either with `project_patch` or a
|
|
446
|
+
normal deploy. `GET /v1/templates/{name}` returns the template's files, and
|
|
447
|
+
`POST /v1/templates/{name}/fill { "words": { "name": "..." } }` returns them
|
|
448
|
+
with those words written into the markup as text.
|
|
449
|
+
|
|
450
|
+
## Temporary deploys
|
|
451
|
+
|
|
452
|
+
[Deploy with two HTTP calls](https://somewhere.cloud/docs/start.txt) to publish a first app without an account.
|
|
453
|
+
After the human claims it, [check what the HTTP key can do](https://somewhere.cloud/auth.md#after-claim).
|
|
454
|
+
|
|
455
|
+
In the Somewhere MCP connector, you can call `project_deploy` without an
|
|
456
|
+
account. Send a `name` and a `files` map. Give the person the returned live
|
|
457
|
+
URL, claim link, and expiry. Keep the `session_id` private. Reuse it with the
|
|
458
|
+
returned `project_id` in `project_logs`, `errors`, and further deploys.
|
|
459
|
+
Connect a Somewhere account to use the rest of the tools.
|
|
460
|
+
|
|
461
|
+
`somewhere deploy --temporary` is the CLI path. Give the human the live URL, claim link and expiry returned by the deploy. Opening the claim link and signing in keeps the app. Redeploying keeps the same URL and expiry.
|
|
462
|
+
|
|
463
|
+
Deploy to the public live URL and verify it there. `project_rollback`
|
|
464
|
+
returns a temporary project to its previous working version. Temporary projects
|
|
465
|
+
can also restore a retained deploy from the last 24 hours by number. To go back
|
|
466
|
+
further, redeploy a saved copy of that source with `somewhere deploy`.
|
|
467
|
+
|
|
468
|
+
## project_deploy — replaces files; preserves omitted functions by default
|
|
469
|
+
|
|
470
|
+
project_deploy fully replaces static files — a file you omit is DELETED —
|
|
471
|
+
but a function you omit is KEPT LIVE (merge-preserved), NOT deleted, and the
|
|
472
|
+
deploy WARNS you, naming each preserved function. To actually drop a function
|
|
473
|
+
pass replace_functions: true (then omitted functions ARE deleted) or use
|
|
474
|
+
project_patch with delete_files. There is no partial / incremental file
|
|
475
|
+
update through this tool — use project_patch for that.
|
|
476
|
+
|
|
477
|
+
If you deploy this:
|
|
478
|
+
{ files: { "index.html": "..." } }
|
|
479
|
+
...then deploy this next:
|
|
480
|
+
{ files: { "about.html": "..." } }
|
|
481
|
+
...index.html is GONE. Only about.html exists.
|
|
482
|
+
|
|
483
|
+
To update one file through project_deploy you must include EVERY file
|
|
484
|
+
you want live in the same call. For small edits, reach for project_patch
|
|
485
|
+
instead.
|
|
486
|
+
|
|
487
|
+
**Partial deploys (`scope`).** Pass `scope: 'functions'` to deploy ONLY
|
|
488
|
+
your functions and leave the static frontend untouched — so a backend-only
|
|
489
|
+
deploy can't wipe the frontend — or `scope: 'static'` for the inverse.
|
|
490
|
+
The default touches both (static files replaced, omitted functions preserved unless replace_functions:true).
|
|
491
|
+
|
|
492
|
+
**Successful production publications with a predecessor carry `previous`:**
|
|
493
|
+
`{ version, rollback_available, note?, message }`, naming the version live immediately
|
|
494
|
+
before that activation. Its one-line message is "Version N is kept;
|
|
495
|
+
project_rollback returns to it." for connector/MCP, or names `somewhere rollback --yes`
|
|
496
|
+
for CLI callers (HTTP callers get `POST /v1/promote/rollback`). If the build is
|
|
497
|
+
no longer restorable it says "Version N is no longer restorable; deploy its source
|
|
498
|
+
again to bring it back." When that version has a note, the line ends with `Note "…".`
|
|
499
|
+
First deploys, preview-only writes and unchanged no-op
|
|
500
|
+
deploys have no new activation predecessor. The CLI prints the message; JSON keeps
|
|
501
|
+
the field. The hint describes that activation; a later publish or automatic rollback
|
|
502
|
+
can change the target, and rollback still checks schema safety.
|
|
503
|
+
|
|
504
|
+
`project_deploy_log({ project_id, version?, release_id? })` returns the
|
|
505
|
+
build log for a past deploy without re-running it — and also carries
|
|
506
|
+
`last_failed_build` (the most recent build that failed to compile),
|
|
507
|
+
`last_rejected` (the most recent deploy rejected before compile, e.g.
|
|
508
|
+
bundled-output detection), and `recent_failures` (up to 5 safe rows with
|
|
509
|
+
`failure_id`, `classification`, `message`, `remediation`, and version/time).
|
|
510
|
+
Resolve one exact reference with
|
|
511
|
+
`somewhere api GET /v1/deploy/failure/<failure_id>`; it requires project
|
|
512
|
+
access and never returns the private diagnostic or stack. A project whose first deploy
|
|
513
|
+
ever failed has no successful build to show — the call returns
|
|
514
|
+
`version: null` with an empty `build_log` and whatever failure context
|
|
515
|
+
exists, which IS the answer to "why did my deploy fail."
|
|
516
|
+
|
|
517
|
+
**The reference check finishes after live.** A deploy response can carry
|
|
518
|
+
`reference_check: { status: 'pending', requested_at }`: an advisory
|
|
519
|
+
TypeScript pass (undefined names, type mismatches) that runs after the release
|
|
520
|
+
is live and never changes or blocks it. Read its result from that version's
|
|
521
|
+
deploy log; in a linked folder `somewhere call` defaults to that project:
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
somewhere call project_deploy_log '{"version":<version>}' | jq '.data.reference_check'
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
`status` becomes `checked` with a `findings` count (the findings join
|
|
528
|
+
the log's `warnings`), or `unavailable` when the pass could not run or
|
|
529
|
+
never finished (`reason: 'not_finished'`); `unavailable` is never a clean
|
|
530
|
+
result.
|
|
531
|
+
|
|
532
|
+
## project_patch — incremental
|
|
533
|
+
|
|
534
|
+
Use `files` to write one or more whole files in a single patch, or
|
|
535
|
+
`edits` for ordered find/replace across files. Unchanged files are preserved. Static-file
|
|
536
|
+
changes go live in ~1 second; function changes in 2–4 seconds.
|
|
537
|
+
Read `project_export` first and pass the returned `active_release_id`
|
|
538
|
+
as `base_release_id` on each patch, including dry runs. An optional
|
|
539
|
+
`base_version` adds a version check; it does not replace the release anchor.
|
|
540
|
+
|
|
541
|
+
**Find / replace (~200 bytes on the wire — preferred for small edits):**
|
|
542
|
+
|
|
543
|
+
project_patch({
|
|
544
|
+
project_id: "my-app",
|
|
545
|
+
base_release_id: "<active_release_id from project_export>",
|
|
546
|
+
path: "index.html",
|
|
547
|
+
find: "<h1>Pricing</h1>",
|
|
548
|
+
replace: "<h1>Plans & pricing</h1>"
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
Replaces every occurrence of `find` with `replace`. If `find` doesn't
|
|
552
|
+
match anywhere in the file, you get a 400 `FIND_NOT_FOUND` with a
|
|
553
|
+
snippet of what the file currently says. A sufficiently similar region
|
|
554
|
+
also appears in `data.closest_match`; unrelated text may have no match.
|
|
555
|
+
Re-read the source and correct the substring with that export’s release
|
|
556
|
+
anchor. This is the token-optimal path for visual-editor
|
|
557
|
+
iteration (Claude Design, Cursor).
|
|
558
|
+
|
|
559
|
+
**Ordered edits (many small changes, one patch):**
|
|
560
|
+
|
|
561
|
+
project_patch({
|
|
562
|
+
project_id: "my-app",
|
|
563
|
+
base_release_id: "<active_release_id from project_export>",
|
|
564
|
+
edits: [
|
|
565
|
+
{ path: "src/App.tsx", find: "const TITLE = 'Old'", replace: "const TITLE = 'New'", expect: 1 },
|
|
566
|
+
{ path: "src/App.tsx", find: "<Footer />", replace: "<Footer year={2026} />" },
|
|
567
|
+
{ path: "styles.css", find: "color: red", replace: "color: teal" }
|
|
568
|
+
]
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
`edits` replaces top-level `path`/`find`/`replace`. The edits apply in
|
|
572
|
+
order to the source of `base_release_id` (a later edit to the same file
|
|
573
|
+
sees the earlier ones) and publish as one patch. If any edit does not
|
|
574
|
+
match, nothing is published: `FIND_NOT_FOUND` with zero-based
|
|
575
|
+
`data.edit_index`. `expect: n` requires exactly n non-overlapping
|
|
576
|
+
matches, else `FIND_COUNT_MISMATCH` with `data.expected` and
|
|
577
|
+
`data.actual`. At most 200 edits per call. A path is edited, written
|
|
578
|
+
whole (`files`), or deleted (`delete_files`) in one patch, never two of
|
|
579
|
+
these. Unified diffs are not a patch format: ordered exact replacements
|
|
580
|
+
plus whole-file writes cover the same changes without a second parser.
|
|
581
|
+
From a shell, `somewhere call project_patch --file args.json` reads the
|
|
582
|
+
arguments from a file, and `somewhere deploy` publishes a local tree.
|
|
583
|
+
|
|
584
|
+
**Full content (rewriting the file):**
|
|
585
|
+
|
|
586
|
+
project_patch({
|
|
587
|
+
project_id: "my-app",
|
|
588
|
+
base_release_id: "<active_release_id from project_export>",
|
|
589
|
+
path: "api/hello.ts",
|
|
590
|
+
content: "export default async (req, sw) => Response.json({ v: 2 })"
|
|
591
|
+
})
|
|
592
|
+
|
|
593
|
+
Paths are auto-routed: anything under `api/` or `_lib/` (or a root
|
|
594
|
+
`[id].ts`-style parametric route) is function source; everything else
|
|
595
|
+
is a static file. Every file under `api/` is a route except helpers: a
|
|
596
|
+
file or folder whose name starts with `_` (`api/_lib.ts`, `api/_lib/db.ts`)
|
|
597
|
+
is import-only and never becomes a route.
|
|
598
|
+
|
|
599
|
+
**Binary assets** (images, fonts) — `content` and `find`/`replace`
|
|
600
|
+
operate on text. Use the binary write surface (`update_binary_files`)
|
|
601
|
+
for raw bytes; trying to ship them through this tool's text fields
|
|
602
|
+
corrupts them via UTF-8.
|
|
603
|
+
|
|
604
|
+
**Delete:** `delete_files` is an array of paths. Works for both
|
|
605
|
+
static files and functions; missing paths are silently ignored.
|
|
606
|
+
|
|
607
|
+
**Conflict check.** Send the observed `active_release_id` as `base_release_id`
|
|
608
|
+
when deploying or patching released code. A stale base returns 409
|
|
609
|
+
`STALE_RELEASE_BASE`. The numeric `expected_version` field belongs to the
|
|
610
|
+
deploy counter for projects without releases. A patch to a released project
|
|
611
|
+
that also supplies `base_release_id` ignores `expected_version` and returns a
|
|
612
|
+
`source_base_note` on success, including on dry runs.
|
|
613
|
+
|
|
614
|
+
Everything you don't name stays untouched.
|
|
615
|
+
|
|
616
|
+
What is NOT affected by a deploy:
|
|
617
|
+
- Env vars (list them with `somewhere env list`)
|
|
618
|
+
- Database contents (managed by db_query, db_migrate)
|
|
619
|
+
- Uploaded files written via fs_write / sw.fs (separate storage)
|
|
620
|
+
|
|
621
|
+
## Automatic sitemap and robots files
|
|
622
|
+
|
|
623
|
+
See `recipe-seo` → `automatic-sitemap-and-robots-files` for generated
|
|
624
|
+
files, app-supplied overrides and client-router paths.
|
|
625
|
+
|
|
626
|
+
## Example
|
|
627
|
+
|
|
628
|
+
project_deploy({
|
|
629
|
+
project_id: "my-app",
|
|
630
|
+
files: {
|
|
631
|
+
"index.html": "<html>...</html>",
|
|
632
|
+
"styles.css": "body { color: red }"
|
|
633
|
+
},
|
|
634
|
+
functions: {
|
|
635
|
+
"api/hello.ts": "export default sw.endpoint({ auth: 'none', handler: async () => ({ ok: true }) });"
|
|
636
|
+
},
|
|
637
|
+
binary_files: {
|
|
638
|
+
"images/logo.png": "iVBORw0KGgo..."
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
files = static assets (stored source is unchanged; served HTML can receive the
|
|
643
|
+
temporary expiry and claim notice or a development/review overlay)
|
|
644
|
+
functions = server-side code with sw access, routed by file path
|
|
645
|
+
binary_files = images/fonts/PDFs as base64, decoded on the server
|
|
646
|
+
|
|
647
|
+
## After every deploy, the platform automatically:
|
|
648
|
+
|
|
649
|
+
1. **Screenshots the live site** — desktop + mobile, captured per
|
|
650
|
+
version. The dashboard uses these as previews.
|
|
651
|
+
→ `project_screenshots({ project_id })` or
|
|
652
|
+
`GET /v1/deploy/screenshots`.
|
|
653
|
+
2. **Generates a Mermaid architecture diagram** — rendered inline on
|
|
654
|
+
the project Overview.
|
|
655
|
+
→ `GET /v1/deploy/architecture`.
|
|
656
|
+
3. **Writes a plain-English description of what your app does** —
|
|
657
|
+
shown under the project name on the dashboard.
|
|
658
|
+
→ `GET /v1/deploy/description`.
|
|
659
|
+
|
|
660
|
+
Screenshots, architecture, and description run after the deploy
|
|
661
|
+
response returns. The LLM security review runs on demand — call
|
|
662
|
+
`security_review({ project_id })` or `POST /v1/security/review` after a
|
|
663
|
+
deploy. Every plan can request a review. Paid plans get a longer report.
|
|
664
|
+
Eligible paid plans also review when a preview is promoted. It returns
|
|
665
|
+
structured findings against 9 risk categories (auth bypass, raw SQL, unsafe
|
|
666
|
+
payment metadata, env leaks, privilege escalation, RCE, email spoofing,
|
|
667
|
+
conversation hijack, CSRF).
|
|
668
|
+
Separately, a quick regex scanner
|
|
669
|
+
also runs during compile and surfaces obvious footguns as advisory
|
|
670
|
+
`warnings` in the deploy response — cheap synchronous gate, every
|
|
671
|
+
tier. Full reference: `docs({ topic: 'deploy-intelligence' })`.
|
|
672
|
+
|
|
673
|
+
## Check BEFORE you deploy (no deploy required)
|
|
674
|
+
|
|
675
|
+
The default check gives a fast green/red without shipping, so you fix everything
|
|
676
|
+
before deploying once instead of deploy → error → fix → redeploy:
|
|
677
|
+
|
|
678
|
+
- **`project_check({ project_id, files?, functions? })`** — run this after
|
|
679
|
+
editing source and before every deploy. It typechecks / compiles / lints
|
|
680
|
+
the changed files with the SAME compile gate a
|
|
681
|
+
real deploy runs (syntax, undefined symbols / dropped imports,
|
|
682
|
+
JSX-in-.js, Vite-only `import.meta.glob`) and returns
|
|
683
|
+
`{ ok, errors: [{ file, line, column, message, kind }], error_count,
|
|
684
|
+
reference_checked, syntax_checked, notes }` — writing nothing, no
|
|
685
|
+
version change. A green here means the deploy's compile step passes too.
|
|
686
|
+
(`POST /v1/deploy/check`.) The response also carries `lint`: the same
|
|
687
|
+
warning-only source checks as `somewhere lint` (`somewhere deploy-check
|
|
688
|
+
--json` prints it).
|
|
689
|
+
|
|
690
|
+
## Deploy size limits
|
|
691
|
+
|
|
692
|
+
These size checks apply to every deploy on every plan and run before compilation.
|
|
693
|
+
|
|
694
|
+
| Ceiling | Value | Refusal | Instead |
|
|
695
|
+
|---|---|---|---|
|
|
696
|
+
| Decoded source, functions and assets together | 20 MiB | 413 `DEPLOY_TOO_LARGE`, naming the largest files | Put images, video and fonts in file storage and reference their public URLs |
|
|
697
|
+
| Files in one deploy | 1,500 | 400 `BUILD_ERROR` (too many files) | Move generated or media files to file storage |
|
|
698
|
+
| Text source (code, styles, markup) | 5 MiB | 400 `BUILD_ERROR` (source bytes) | Keep data files out of the source; load them from file storage |
|
|
699
|
+
| JSON request body of any deploy (CLI, MCP, API) | 40 MiB (default) | 413 `DEPLOY_TOO_LARGE` | Upload images, video and fonts to file storage first and reference their URLs |
|
|
700
|
+
|
|
701
|
+
## Image and font caching
|
|
702
|
+
|
|
703
|
+
Import images and fonts from source, or reference them with CSS `url()`, to
|
|
704
|
+
ship them at content-hashed `/_compiled/` addresses. PNG, JPEG, GIF, WebP, AVIF,
|
|
705
|
+
SVG, ICO, WOFF, WOFF2, TTF and OTF assets use the same
|
|
706
|
+
`public, max-age=31536000, immutable` policy as compiled scripts and styles.
|
|
707
|
+
Changing an asset changes its address; HTML references to emitted assets are
|
|
708
|
+
rewritten too.
|
|
709
|
+
|
|
710
|
+
Fixed-name media from `public/` or `static/` has a bounded policy:
|
|
711
|
+
`public, max-age=60, stale-while-revalidate=60`, with an ETag. A changed file
|
|
712
|
+
can remain cached for at most two minutes. This policy requires source-folder
|
|
713
|
+
provenance from a new deployment; older deployments retain revalidation. It
|
|
714
|
+
does not apply to HTML, API responses or authenticated views. Deploy and
|
|
715
|
+
deploy-check name static-folder images or fonts of at least 32 KiB and suggest
|
|
716
|
+
importing them from source for a permanent address.
|
|
717
|
+
|
|
718
|
+
Project public configuration is inlined before module execution on ordinary
|
|
719
|
+
HTML document requests. The external no-store script remains a fallback; it
|
|
720
|
+
is not a shared cache across projects.
|
|
721
|
+
|
|
722
|
+
`deploy-check` includes imported binary images and fonts in the same source tree
|
|
723
|
+
as a real deploy. It compiles them and reports static-media cache notices without
|
|
724
|
+
publishing a new app version.
|
|
725
|
+
|
|
726
|
+
## Privacy facts
|
|
727
|
+
|
|
728
|
+
Source deploy output includes release privacy facts, also readable with `project_privacy_facts`
|
|
729
|
+
and `somewhere privacy`. They list declared owner tables, file collection names and outside
|
|
730
|
+
domains found in source. Requests built while the app runs are not covered. Warnings do not
|
|
731
|
+
block deploy. No collection or outside-domain signals means a short section with no warnings.
|
|
732
|
+
A privacy-page name is only a guess from file and route names. Sign-in configuration and
|
|
733
|
+
executed service usage are not included; unavailable signals are reported as unavailable.
|