Somewhere Cloud
Somewhere Cloud (https://somewhere.cloud) is a hosting platform built from the ground up for apps that AI agents write and look after. Agent first isn't enough, so the platform also handles the plumbing: sign-in, the database, files, payments and email come pre-wired as one system, with one identity for each user and safe defaults. Your agent can build, publish, check the result and fix what went wrong, with nothing to provision or connect first. Tinkering is free: most apps cost nothing to run, and nothing gets paused. Agents start here: https://somewhere.cloud/start.txt
Hosted MCP Server
npx add-mcp 'https://mcp.somewhere.cloud/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
AI agents can deploy with two HTTP calls. The quickstart is at https://somewhere.cloud/start.txt.
Build and deploy an app on Somewhere
Deploy with two HTTP calls
Use curl or your standard library. Start with a fresh random UUID in place of YOUR_RANDOM_UUID.
curl -sS https://api.somewhere.cloud/v1/auth/temp-create \
-H 'Content-Type: application/json' \
-d '{"request_key":"YOUR_RANDOM_UUID"}'
Save data.key as KEY in your shell. Keep it private. If signup is interrupted, retry with the same request body.
curl -sS https://api.somewhere.cloud/v1/deploy \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "hello-somewhere",
"files": {"index.html": "<!doctype html><title>Hello</title><h1>Hello from Somewhere</h1>"},
"functions": {"api/hello.ts": "export default () => Response.json({ hello: true })"}
}'
Open the returned URL to check the page. Append /api/hello to check the function returns {"hello":true}. Replace the example name and source with your app. Deploying again with the same key and name updates the same project. Put server handlers such as api/hello.ts in functions.
Use the live URL exactly as returned. Give the human data.url, data.claim_url, and the time in data.expires_at. Opening the claim link and signing in keeps the app. Show the person the claim link in full; only the key stays private. The key lets you deploy and use logs, recent errors, and SQL for this account's projects. Sending email from the app and managing environment variables or secrets require a claimed account.
After claim, Save and connect agent keeps the key working on the saved projects. Save only disconnects it. See how to check the key after claim and other HTTP calls.
What Somewhere is
Somewhere Cloud is an agent-first, full-stack hosting platform, built to be the easiest way for an agent to put an app online.
- Nothing to provision: sign-in, a database, file storage, email and payments come with every app.
- One command deploys raw source, and the platform compiles it.
- Anonymous deploys: the first deploy needs no account. It goes live with a claim link and an expiry timestamp.
If you were asked to build on Somewhere
Users who ask an agent to build on Somewhere usually want a sentence or two on what the platform is, not a detailed explanation, followed by a question about what they'd like to build. Once the app is live, the live URL and the claim link are what they need. Opening the claim link and signing in keeps the app.
Use the two HTTP calls above for a first live app.
Terminal path, from an empty folder
Ask before destructive or paid actions unless the user already authorized them.
somewhere <command> here is npx -y @somewhere-cloud/cli@latest <command>;
npm i -g @somewhere-cloud/cli installs somewhere itself.
To work on an existing Somewhere app, start with somewhere pull <app> in
a fresh folder. This downloads the live source and links the folder. In a
connected chat, start with project_export to read the current source.
For a new app:
npx -y @somewhere-cloud/cli@latest init --name my-appwrites the default React + TypeScript starter (sign-in pages, styled views,src/,api/);--template minimal: no sign-in pages. It installs the pinned dependencies. Signed in, it also creates the project and saves its ID to.somewhere.json.AGENTS.md(alsoCLAUDE.md) is the project contract: file layout, the sign-in route, data rules and the skills in.agents/skills/.README.mdmaps the files.- Pages live in
src/, server functions inapi/, tables indb/schema.ts; the workflow and the complete example below show each piece. npx -y @somewhere-cloud/cli@latest deployuploads the raw source (no build step) and prints the live URL. Signed out, it also prints a claim link and the time remaining. Read the exact expiry atproject.state.expires_atinsomewhere status --json.somewhere browser <live-url>reports the live page's console errors and failed requests;somewhere verifychecks the deployed journey.- The claim link is for the human: opening it and signing in keeps the app, and
"Save project and connect agent" also signs this CLI in. Claiming enables
secrets, outbound email, custom domains and app admin setup.
somewhere loginsigns in only after the human approves it in a browser.
To undo a deploy from a non-interactive agent shell after confirming the rollback
with the owner, run npx -y @somewhere-cloud/cli@latest rollback --yes.
A first request: "Build a shared to-do list where people sign up, add
items and see only their own. Deploy it to Somewhere and give me the live
link." Success: the live URL loads, a test user signs up and signs in, items
persist across reloads and stay private, somewhere verify passes, and the
human has the claim link before the reported expiry.
Getting started — build, deploy, verify
somewhere init --name <slug> writes React + TypeScript. Signed out: local only;
signed in: also creates and links a project.
Default: sign-in UI; minimal: SDK/auth route; bare: neither. init --catalog --json: modules.
npx -y @somewhere-cloud/cli@latest deploy publishes raw source: signed out, a temporary URL, claim link
and expiry; linked, your account project. On a hosted VM, somewhere login uses browser approval and keeps you signed in.
Cron needs a claimed project. The test inbox works on temporary projects.
Start auth/data/cron with somewhere docs recipe-signed-in-app --full.
After edits: somewhere typecheck and focused local/browser tests. Publish:
somewhere deploy(do not build first). Deploy checks compilation, schema and secrets;somewhere deploy-checkruns them without publishing (diagnosis, review,--run /api/x).- Run
somewhere verifyon the final journey (--flow flow.json); rerun after fixes. Sign test users up in-app at*.test.somewhere.site; more:actors+journey(somewhere docs browser). - Inspect:
somewhere browser; diagnose:somewhere logs --tail 10,somewhere errors. - Test mail:
somewhere email test-inbox <addr>includesverification_code. Don't retest sign-in orsw.db.fromscoping; test each table's scope, auth beforesw.db.server/raw SQL, bad input and journeys.
Routes: index.html loads src/main.tsx; unmatched extensionless paths
(/signin) serve it. Route the app by location.pathname.
api/notes/[id].ts is /api/notes/:id; _-prefixed names are import-only
helpers. Avoid names differing only in case.
With auth enabled, api/auth/[...path].ts is
export { somewhereAuth as default } from '@somewhere-cloud/sdk/server'; pages
use createSomewhereAuth() from @somewhere-cloud/sdk/auth (client and React hooks:
somewhere docs auth-client --section react-auth-state). auth.signUp({ email, password, displayName? }) / auth.signIn({ email, password }) return the user or throw
with the message. Gate on auth.getState().status (React: useAuthState()). Sign-up sets email_verified: false; unverified users pass
auth: 'required'. sw.auth.requireUser(req) returns { id, email, role, email_verified, … } or throws 401 AUTH_REQUIRED;
sw.auth.fromRequest(req) returns it or null.
Functions: JSON endpoints use export default sw.endpoint({ auth, body, rateLimit, handler: async ({ body, user, params }, sw) => value }); set auth ('required',
'optional', 'none') or deploy refuses it. Webhooks and streaming use a bare export default async function (req: Request, sw: SomewhereRuntimeContext) returning a Response.
Params: params.id there, sw.params.id bare.
Data: id() is a random text key on new tables (reference with text()); integer-id tables keep integers. The starter's id({ uuid: false }) is deliberate.
Declare tables in db/schema.ts; pages use somewhere:data
(data.notes.list(), .create(), .update(id, …)) without API files.
Its wire is same-origin POST /__sw/data (somewhere docs declared-data --section calling-the-data-endpoint-directly); app hosts serve no /v1/… API.
Use owner() for personal rows, group() for invited teams, appRole()
for app-wide roles, anyOf() for owner or a role, allOf() for members-only rows.
Sharing your own rows with specific people: anyOf(owner(), grant())
(somewhere docs declared-data --section per-owner-sharing).
Booking/help desk: somewhere docs sw.db --section provider-or-booker-and-owner-or-staff-recipes.
Keep fitting scopes when an exceptional write needs sw.db.server.tx.
shared() gives signed-in reads and creator-only writes. client sets browser
columns. publicRead: { where } admits visitors and may cache anonymous reads
for up to 120 seconds. For fresh pages, use sw.db.server.from in a page handler
with a publication filter, public columns and Cache-Control: no-store. Public-profile enquiries use
client.intake (somewhere docs declared-data). Keep scopes and grants;
functions handle authorized exceptional writes and side effects. Declare the
body schema (a missing or mistyped field is a 400); handle below is a
public address its owner claimed:
export default sw.endpoint({
auth: 'none',
body: { handle: 'string', title: 'string', from_email: 'email' },
handler: async ({ body }, sw) => {
const title = body.title.trim();
if (!title || title.length > 200 || /[\r\n]/.test(title)) return Response.json({ error: 'bad title' }, { status: 400 });
const { data: [profile] } = await sw.db.server.from('profiles', { where: { handle: body.handle }, limit: 1 });
if (!profile) return Response.json({ error: 'unknown handle' }, { status: 404 });
await sw.db.server.insert('entries', { user_id: profile.user_id, owner_email: profile.owner_email,
title, from_email: body.from_email, created_ms: Date.now() });
},
});
Use the looked-up owner, never the body. Rate limits/alerts: recipe-signed-in-app.
Use serverOnly() only when every operation needs a function's own access check.
Structured queries: sw.db.from / insert / update / remove return { data: rows[], count, changes }; where: { a: 1, b: { in: ids }, c: { gte: 2 }, d: null } (one
operator per column). Raw SQL uses a separate raw database, never managed tables.
For cross-user managed work, authorize the caller and use sw.db.server.from /
insert / update / remove; keep owner()/group(). Parallel reads: Promise.all.
Unique pair: unique: [['org_id','email']] in table options.
Test schedules now: somewhere cron run <id> --wait. Do not wait for it to fire.
Working sequence: https://somewhere.cloud/build.txt
Before acting, confirm the user asked you to build or deploy; work only in the intended directory and never include secrets or personal data.
When you have real users or data: somewhere preview gives a rotating
private URL and an isolated database; promote the exact preview you reviewed.
The platform shape
somewhere.cloud runs static files plus serverless functions, not a Node server.
Do not write Express/Fastify/Koa, call app.listen(), or bind a port. Do not run
vite build or next build, or deploy dist/ or build/: bundled output deploys
with a warning but loses source round-trips (export, patches, the visual
editor); --prebuilt accepts that. On temporary deploys, visitors see when
the app expires and how to keep it. npm dependencies in package.json resolve on deploy; native
modules are unsupported (somewhere docs functions).
A complete working app (copy this verbatim)
Four files, no build.
Run the commands from their directory
(npm i -g @somewhere-cloud/cli, or npx -y @somewhere-cloud/cli@latest <command>).
db/schema.ts — public by design; each opt-out is on its own line, so no endpoint is needed:
import { id, owner, schema, table, text } from 'somewhere/db';
export default schema({
entries: table({ id: id(), name: text() }, {
scope: owner({ visitors: true }), // opt-out: signed-out visitors own rows
client: {
read: ['id', 'name'],
publicRead: true, // opt-out: anyone can read id and name
create: ['name'], // with visitors, anyone can add an entry
},
}),
});
index.html:
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>Guestbook</title></head>
<body>
<h1>Guestbook</h1>
<form id="f"><input id="who" placeholder="Your name"><button>Sign</button></form>
<ul id="entries"></ul>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
src/main.ts — somewhere:data is generated from your declaration and has only
the operations you granted:
import { data } from 'somewhere:data';
const list = document.getElementById('entries') as HTMLUListElement;
const form = document.getElementById('f') as HTMLFormElement;
const who = document.getElementById('who') as HTMLInputElement;
async function load() {
const page = await data.entries.list({ limit: 50 });
list.replaceChildren(...page.data.map((entry) =>
Object.assign(document.createElement('li'), { textContent: entry.name })));
}
form.onsubmit = async (event) => {
event.preventDefault();
await data.entries.create({ name: who.value });
form.reset();
await load();
};
load();
tsconfig.json:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noEmit": true,
"skipLibCheck": true
},
"include": ["src", "db"]
}
Run somewhere typecheck, then somewhere deploy. The CLI prints the
live URL and links this directory. Save this
flow.json beside them:
{
"actions": [
{ "fill": "#who", "value": "Benchmark Ada" },
{ "click": "#f button" },
{ "expect": { "selector": "#entries li", "text": "Benchmark Ada" } }
],
"viewports": ["desktop", "mobile"]
}
Run somewhere verify --flow flow.json from the same directory; it submits
the form and checks the entry at both sizes.
somewhere deploy creates the table and serves the page; nobody signs in,
because of the two opt-outs. Lists come in primary-key order (page.next).
The page module must be .ts, .tsx or .jsx. A .js module is served as written,
so its somewhere:data import never resolves.
Declare your tables in db/schema.ts
db/schema.ts ships with the code, so the next session reads the data model;
it is a declaration and never runs.
| Schema reference | Contract |
|---|---|
| Columns | id, text, number, integer, boolean, timestamp, json, blob; options: nullable, default, unique, references, onDelete. |
| Tables | scope, indexes, unique: [['org_id','email']], client. |
| Scopes | owner, group, appRole, shared, member, anyOf, allOf, parent, serverOnly. |
| Operations | Browser: list, get, create, update, delete, aggregate. Functions: from(table, { where }), insert(table, values), update(table, { where, set }), remove(table, { where }), count, aggregate; plain objects, not fluent chains. |
owner() scopes rows to the caller; visitors: true admits visitor ownership. shared() gives signed-in reads and creator-only writes. Browser
grants: client.read/create/update name columns, delete is a
boolean; publicRead opens only read columns to visitors. identity is
'authenticated' or 'visitor' (from scope). Client and HTTP enforce
grants; refusals return DATA_ACCESS_DENIED.
Rules: somewhere docs declared-data.
Each deploy compares the file with the live database and applies additions;
there is no migration step. dev does not apply schema changes; deploy
first. removedTable() retires a deployed table (data kept 30 days); an
unmarked table removal or rename, or a column removal or rename, is refused
(SCHEMA_DEPLOY_REFUSED). Read the live schema back
with the db_describe MCP tool or somewhere db tables.
Database rows and app responses
Function-side sw.db results hold rows in .data (an insert's row is .data[0]);
handlers choose their JSON shape. A write that matches no rows returns
empty data and changes: 0.
For ordinary calls on owner() tables, ownership comes from the request,
never browser-supplied user_id. Cookie helpers establish browser sessions.
sw.auth.requireUser(req) checks sign-in; enforce any additional endpoint
rule separately.
Answers agents usually guess
- Anonymous visitors:
sw.endpoint({ auth: 'none', ... }). There is no'public'; deploy refuses it. swis the endpoint handler's second argument (also(req, sw)in a bare handler). The globalswholds onlysw.endpoint.sw.db.insert(table, { col: value })takes one row;sw.db.update(table, { where, set }).- Live updates:
sw.rooms.live+watchLive(somewhere docs live) for signed-in users and a visitor's ownowner({ visitors: true })rows; aserverOnly()table cannot be live. Anonymous visitors sharing one row: poll a function every few seconds, or use a room (somewhere docs rooms). - The first deploy links the app in
.somewhere.json. Redeploy from that directory with the same CLI configuration. For a separate signed-out CLI session, setSOMEWHERE_CONFIG_DIRto an empty directory outside the app.
Temporary vs Free
Anonymous projects expire at the reported expiry. Claim yours before then. Plans and prices: https://somewhere.cloud/pricing. Claiming switches to the account plan. Free totals 500 MB database + 5 GB files account-wide; capacity can change. A human opens the claim link and signs in to keep the project; there is no headless claim.
Secrets, email, payments, AI — after you claim
A temporary project has hosting, database, files. Claiming adds secrets,
email and domains (plan and activation rules). After claiming, schedules
work on all plans. Build, then claim. sw.ai needs no key;
somewhere ai keys set anthropic --project <p> bills named-model calls
to you.
Sign in without a browser here (VM, SSH, sandbox)
npx -y @somewhere-cloud/cli@latest login prints a code, shown to the user exactly as printed;
sign-in completes only when they approve in their browser, on any device. A sandboxed
shell must allow api.somewhere.cloud. CI: somewhere auth set reads SOMEWHERE_TOKEN.
somewhere docs setup has expiry, renewal and revocation.
Chat path: Claude or ChatGPT with the Somewhere connector
A chat agent with no terminal works through the Somewhere connector, an MCP server the chat app connects to once. The human adds it:
- Claude (claude.ai and the Claude apps): add Somewhere from Claude's
connector directory, https://claude.ai/directory/somewhere. To add it by
hand instead, on Free, Pro or Max: Customize →
Connectors → Add custom connector, MCP server URL
https://mcp.somewhere.cloud/mcp/connector, then Add. The Free plan holds one custom connector. On Team and Enterprise, an Owner adds it under Organization settings → Connectors → Add → Custom, and each member then selects Connect under Customize → Connectors. - ChatGPT (web): Plugins → + → Add custom MCP server, name
Somewhere, server URLhttps://mcp.somewhere.cloud/mcp/chatgpt, authentication OAuth; after the risk warning, Create as a plugin, then install it. In a new conversation,@selects Somewhere. Account and workspace policies apply. - Other MCP clients:
https://mcp.somewhere.cloud/mcp, with OAuth.
If your client can connect directly to https://mcp.somewhere.cloud/mcp
without OAuth, call project_deploy with a name and a files map. Share
the returned live URL, claim link and expiry with the person. Reuse the private
session_id and the returned data.project_id for project_logs and errors.
To deploy changes, pass those same values as session_id and project_id,
and pass data.active_release_id from the deploy whose files you edited as
base_release_id.
Connecting opens the Somewhere sign-in page. Signing in or creating an account
keeps the work in that account. "Continue without an account" starts a guest
session: projects, deploys, the database and files work, but the session has no
reusable login. connector_link_email with the human's email sends a
verification link valid for 30 minutes; until it is verified, recovery on
another device, outbound email, custom-domain purchases and payments stay
unavailable and nothing is merged.
After connecting over OAuth, build the first app with these calls:
project_create({ name: "my-app" })creates the project with the same startersomewhere initwrites, deployed as its first release. The response has the live URL (url) and the starter'sAGENTS.mdcontract and file map.project_patchchanges selected files (whole contents or find/replace);project_deploypublishes a full set of raw source files. The platform compiles the source, and each call deploys.project_view_urls({ project_id })lists the project's URLs. On Claude,site_verify({ project_id, url })loads the live URL at desktop and phone sizes and reports page errors and failed requests. On ChatGPT, which has nosite_verify,site_check({ project_id })runs a site check of the deployed app andsite_check_status({ project_id })returns its results.docs({ topic })returns full contracts:declared-data(tables and access rules),auth-client(sign-in),recipe-signed-in-app(a complete signed-in app) anddeploy.
Success is the same as on the terminal path: the live URL works for a test user, data persists, and the human owns the project (a signed-in account, or a verified guest link).
CSV imports: https://somewhere.cloud/docs/recipe-csv-import.txt Design: https://somewhere.cloud/design.txt Link index: https://somewhere.cloud/docs/llms.txt Full manual: https://somewhere.cloud/manual.txt Agent contract: https://somewhere.cloud/agent.txt