One command puts a project from your folder on Apiway: a web address, its own Postgres database, secrets, logs and a private preview. Publishing to the live address and your own domain come next. It works the same for you and for an AI agent in a terminal — Claude Code, Codex, Cursor.
Quick start
npx -y apiway login # once: sign in in the browser
npx -y apiway deploy # upload this folder, get the preview link
npx -y apiway deploy --publish # put it on the live addressNo account yet? npx -y apiway deploy --anonymous puts it online at once and prints a link to claim it.
Requirements
- Node.js 20 or newer. Nothing to install: npx runs the CLI.
- Keep
-y: without it npx asks «Ok to proceed?» on the first run, and an agent’s shell waits for an answer that never comes. - A newer CLI is announced after a deploy.
npx -y apiway@latest deploytakes it at once.
Commands
| Command | What it does |
|---|---|
deploy | Upload this folder and update the preview. --publish also publishes. --name names a new app. --dir deploys another folder. --app apps/web picks one app of a monorepo. --json prints the result. --anonymous deploys without an account. --env .env saves the file’s keys as secrets before the first build. --skip-typecheck uploads a Next.js project that builds with typescript.ignoreBuildErrors. |
login · logout | Sign in in the browser, or end the sign-in. |
status | The app’s versions and addresses. |
open · screenshot /page · wake | Open the preview; save a PNG of a page as the owner sees it (--mode mobile); wake a preview that fell asleep after 30 minutes without visits. |
logs | The running app’s log. --published for the live one, --lines N. |
env set KEY=VALUE · env push .env | Save secrets one by one, or every key of a .env file at once. |
token | A token for APIWAY_TOKEN in CI. Valid 30 days. |
The first deploy creates the app and writes its slug to apiway.json. Commit that file: the next deploy updates the same app. A repository cloned from someone else carries their apiway.json: delete it to make your own app from that code. One folder holds one app: in a monorepo each app is deployed with its own --app from a folder of its own.
Signing in
loginopens the browser once and keeps the sign-in in~/.apiway/credentials.json.- No browser here (SSH, a cloud sandbox):
login --no-browserprints a link. Open it on any computer, approve, then copy the code the page shows and runlogin --finish <code>. The link works 10 minutes. - CI: put the output of
tokenintoAPIWAY_TOKEN.
Without an account
npx -y apiway deploy --anonymous puts the folder online with no sign-in and prints a link to claim the app. Whoever opens the link and signs in owns the app — its address, database and files. Nobody claims it in 7 days — it is deleted.
- A visitor’s browser sees a short warning first: the app is unverified, so no passwords or card numbers. Search engines do not index it. An agent’s
curlgets the app itself. - Until it is claimed: no publishing and no own domain; up to 100 MB of code per upload, 10 versions an hour, and a few apps per network address.
- Later deploys from the same folder on the same computer update the same app: its token is kept in
~/.apiway/anonymous.json, not in the folder. After it is claimed, the CLI works under the owner’s sign-in by itself (npx -y apiway loginonce). logs,env setandenv pushwork for it too.screenshot,statusandwakeneed the app to be claimed. Paid features through Apiway (AI, email, SMS) and the owner’s own data (email list, mail, tasks) wait for the claim as well.
What gets built
- A Dockerfile at the root is used as it is (FROM public images only).
- Without one, Apiway picks a standard one: Next.js, a Vite or other static build, a Node server (
npm start), Go (go.mod), Python with aProcfileline such asweb: uvicorn main:app --host 0.0.0.0 --port $PORT, or a plainindex.html. Rust, PHP and Ruby need a Dockerfile; the answer shows one to start from. - The server listens on
$PORT(3000). The deploy warns before the upload when it finds a fixed port such as 8080. - Monorepo (npm, yarn or pnpm workspaces, Turborepo):
deploy --app apps/web. Dependencies are installed at the root; the app is built and run in its folder. - Uploaded: what git keeps (
.gitignoredecides). Never uploaded:node_modules,.next,.git,.data,.env*. Up to 100 MB of code — videos and big data are uploaded by the running app, not with the code. - A key written into the code stops the upload, and the CLI names the file. A Next.js project with TypeScript is type-checked first.
- A sandbox that cannot reach the storage host (some cloud agents) uploads through apiway.ai instead, by itself.
Your database and files
- Every app has its own Postgres. The address is in
DATABASE_URLwhile the app runs — not during the build, so pages that read the database are rendered on request (Next.js:export const dynamic = "force-dynamic"). - Create tables when the app starts: put the migration in the start command, for example
"start": "prisma migrate deploy && next start"ordrizzle-kit migrate && node server.js. A migration that deletes data waits for your yes in Apiway. - The app’s own disk is wiped by every new version. Keep uploads and other files in the database or in object storage, never on the disk.
- Daily backups are on; restore one in the app’s Settings → Backups.
Recover a preview
Open your app in App Factory. If your agent has stopped after a failed preview update, the page tells you whether there is a working preview and links to the earlier version when one exists. If the app reports a required secret, select Open Secrets and save the value there. Select Copy the message and send it to your agent in the same chat to retry the update.
Secrets
env push .envsaves every key of a .env file;env set KEY=VALUEsaves one. The app restarts with them. The code reads them from its environment under the same names.DATABASE_URL,PORT,APP_URLand everyAPIWAY_*key are set by Apiway and are never taken from your file. Quoted values may span several lines (PEM keys), and\ninside double quotes is a line break.- Public build variables (
NEXT_PUBLIC_*,VITE_*,PUBLIC_*,REACT_APP_*) also reach the build, because the framework puts them into the page at build time.
Exit codes
0— done.1— failed: the build log is printed; fix and deploy again.2— a paid plan is needed (the Free limit of apps, days or builds an hour, or publishing). The message is for the owner: the price and the link to pay. An agent sends it to the person as it is.3— the owner confirms the version in Apiway (a database change that deletes data).
On the Free plan one app builds at a time: the CLI waits for the other build instead of giving up.
When something goes wrong
- The app starts but nothing answers — the server listens on a fixed port. Read the port from the
PORTenvironment variable, with 3000 as the fallback. - The build fails reading the database —
DATABASE_URLexists only at runtime. Render those pages on request; run migrations at start. - The home page answered an error — the version is not taken into the preview; the previous one stays, and the log is printed. Fix and deploy again.
- A curl to the preview returns the sign-in page — the preview is private to its owner. Use
screenshot /, or look atlogs. - TypeScript errors stop the upload —
next buildwould stop on them too. Fix them, or, if the project setstypescript.ignoreBuildErrors, rundeploy --skip-typecheck. - A link in the folder (CLAUDE.md → AGENTS.md) goes in as a copy of its file; a link that leads outside the folder is left out and named.
- Sign-in stops after 2 minutes in an agent’s terminal — run
npx -y apiway login --no-browser: open the link anywhere, then send the code to the agent. - Keys are missing in the app —
.envis never uploaded. Runenv push .env.
Plans
On Free the private preview is free (up to 5 apps, 30 days each). Publishing to a public address and your own domain need a paid plan; --publish on Free prints the link to upgrade.
For AI agents
Put this in your project’s AGENTS.md or CLAUDE.md so any agent knows how to ship it:
Deploy: npx -y apiway deploy (preview), npx -y apiway deploy --publish (live).
No Apiway account: npx -y apiway deploy --anonymous, then give the person the claim link.
The app's Postgres is DATABASE_URL (runtime only); secrets: npx -y apiway env push .env.--json prints { slug, status, version, preview_url, url, claim_url }. When the deploy stops early it prints { status: "failed", message }. status is live, failed, needs_payment (with pay_url), needs_confirmation or busy (another app is still building — run the same deploy again in a few minutes). Agents without a terminal (ChatGPT, Claude) use the Apiway MCP tools instead: create_code_app with own_code, then start_preview_update. The plugin for Claude Code and Codex has a deploy skill.
Your own domain
After publishing, connect app.yoursite.com or yoursite.com: Put your app on your own domain.
Source: github.com/apiway-ai/apiway (MIT).