---
title: AI Deploy
description: Deploy Node.js and Next.js apps to your own Hostino Node.js hosting straight from Claude Code and Cursor
sidebar:
  order: 18
  badge:
    text: Alpha
    variant: tip
---

With **AI Deploy**, your AI tool (Claude Code, Cursor or any MCP client) publishes a **Node.js** or **Next.js** project straight to **your own Hostino Node.js hosting**. The app runs inside your own cPanel account: no separate container, no manual upload, no "Setup Node.js App" clicking in cPanel.

:::note[Status]
AI Deploy is live as an **alpha** on [Remote MCP](/en/ai-mcp/remote-mcp/) and works for every **Node.js hosting (Iran location)** service.
:::

## Quick start (3 steps)

1. **Have an active Node.js hosting service.** If you don't, ask the tool for a plan suggestion (`list_plans` with category `nodejs_hosting`) or buy one on the [Node.js hosting page](https://www.hostino.ai/nodejs-hosting).
2. **Connect Remote MCP** ([Claude Code](/en/ai-mcp/connect-claude-code/), [Cursor](/en/ai-mcp/connect-cursor/)). If you connected before, **re-authenticate once** to approve `deploy:read` and `deploy:write` (in Claude Code: `/mcp` → hostino → Re-authenticate).
3. **In your project folder, say:** "Deploy this project to my Node.js hosting."

The tool finds the service, packs and uploads the project, follows the status until `live`, and gives you the site URL.

## What happens behind the scenes

1. **Pick a target:** `list_deploy_targets` returns your Node.js services.
2. **Start the deployment:** `create_deployment` returns a **single-use upload link** (15 minutes) and the exact upload command, which the tool runs in the project root. `node_modules`, `.next`, `.git` and `.env*` files are **not** uploaded.
3. **Make room:** failed and old releases and caches are cleaned up so the plan's disk has enough space.
4. **Install and build on the server:** dependencies are installed and the `build` script runs if you have one — all in a **separate folder**; the current site keeps serving the whole time.
5. **Switch and health check:** the new version is swapped in within milliseconds and checked. **If it doesn't come up, the previous version is restored automatically** and the reason is in the logs.
6. **Follow up:** `get_deployment_status` until `live` or `failed`. On failure, the status answer already includes a `diagnosis` (cause and fix), and `analyze_deployment` and `get_deployment_logs` give more detail.

## Project requirements

| Item | Details |
|---|---|
| `package.json` | Must be at the project **root** |
| Node version | 18, 20 or 22 (default 20) — choose with `node_version` |
| Next.js | Works with no configuration (Pages Router and App Router). No custom server needed |
| Node.js (Express, Fastify, …) | Entry file from `main` in `package.json`, or one of `server.js`, `index.js`, `app.js` (and their `.mjs` variants). The app must listen on **`process.env.PORT`** |
| Build | `scripts.build` runs if present |
| `package-lock.json` | **Strongly recommended:** installs come from an in-country mirror and are faster, and later deploys skip installing entirely when dependencies haven't changed |
| `public/` files | Served by the app itself; `/_next/static` is served directly by the web server |

## Multiple apps, subdomains and paths

- By default the app is published on the **service's main domain**.
- Use `domain` to pick another domain or a **subdomain of the same cPanel account** (create the subdomain in cPanel first).
- Use `app_uri` to publish on a **path**, e.g. `api` → `https://example.com/api/`.
- One account can run several apps with different names (`app_name`). Deploying again with the same `app_name` updates that app.
- If a path already runs an app **you created manually in cPanel**, AI Deploy leaves it alone and returns `domain_has_other_app`.

## Tools

| Tool | Permission | What it does |
|---|---|---|
| `list_deploy_targets` | `deploy:read` | Services that can run a Node.js app, and the apps on each |
| `get_service` | `services:read` | One service's details: deploy capability, direct cPanel login, apps |
| `create_deployment` | `deploy:write` | Start a deployment; input: `service_id`, `app_name`, optional `domain`, `app_uri`, `node_version` |
| `get_deployment_status` | `deploy:read` | `uploading` → `extracting` → `building` → `activating` → `live` or `failed` |
| `get_deployment_logs` | `deploy:read` | Install/build output and the app's runtime log |
| `analyze_deployment` | `deploy:read` | Analyze a failed deploy: cause, evidence from the logs and a concrete fix (read-only) |
| `list_apps` | `deploy:read` | Apps, domain/path, Node version and environment variable **names** |
| `set_app_env` | `deploy:write` | Set/remove environment variables; the app restarts automatically |
| `create_app_database` | `deploy:write` | Create a MySQL database for the app (once per app) |
| `rollback_deployment` | `deploy:write` | Instantly switch back to the previous successful version (no rebuild) |
| `restart_app` | `deploy:write` | Restart the app |
| `open_cpanel` | `hosting:login` | Short-lived, single-use direct cPanel login link (all your hosting, not only Node.js) |

## Environment variables and secrets

- Don't put secrets in code or `.env` (`.env*` files are not uploaded); set them with `set_app_env`. Values are stored **encrypted** and no tool returns them.
- Reserved names (`PORT`, `NODE_ENV`, `PATH`, `NODE_OPTIONS`, …) can't be set.
- `NEXT_PUBLIC_*` variables are baked in at build time; **redeploy** after changing them.
- **Both ways work together:** variables you set yourself in cPanel ("Setup Node.js App") are **kept** by deploys and `set_app_env`, and the tool's variables are added on top. If a name exists in both, the tool's value applies. Removing with `set_app_env` only removes the tool's own variables.

## Database

If the app needs a database, ask the tool to "create a database for this app". `create_app_database` creates a MySQL database and its user inside the same cPanel account and sets the connection details on the app as encrypted environment variables:

| Variable | Value |
|---|---|
| `DATABASE_URL` | `mysql://USER:PASSWORD@localhost:3306/DBNAME` |
| `DB_HOST` / `DB_PORT` | `localhost` / `3306` |
| `DB_NAME` / `DB_USER` / `DB_PASSWORD` | Database name, user and password |

The app restarts after the database is created. The password is never shown in the tool output. In code, use `process.env.DATABASE_URL` with mysql2, Prisma or Drizzle. You can also see the database in cPanel's phpMyAdmin.

## Timing

| Case | Approximate time (small Next.js app, Eco plan) |
|---|---|
| First deploy (full dependency install) | about 2–3 minutes |
| Next deploy with the same `package-lock.json` | about 1 minute (dependencies are not reinstalled) |
| Rollback | a few seconds |
| Node.js app without heavy dependencies | about 15 seconds |

Larger projects take longer; higher plans have faster disks.

## When a deploy fails

You don't have to read the logs yourself. `analyze_deployment` matches the error and the build and runtime logs against known causes on Hostino Node.js hosting and returns, for each, **the cause, the matching log line and a concrete fix**. For a `failed` deploy the same findings are in the `diagnosis` field of `get_deployment_status`, so the tool usually knows the cause without an extra call. The analysis runs on Hostino's side; logs are not sent anywhere else.

| Cause | Sign in the log | Usual fix |
|---|---|---|
| Missing package | `Cannot find module '…'` | Add the package to `dependencies` (not `devDependencies`) and commit `package-lock.json` too |
| Letter case in an import | `Can't resolve './Components/…'` | Linux is case-sensitive; write the import path exactly like the file name |
| Node.js version | `Unsupported engine` | Deploy again with `node_version` 22 (or the version in `engines`) |
| Memory / process limit | `JavaScript heap out of memory`, `EAGAIN` | Make the build lighter, set `NODE_OPTIONS=--max-old-space-size=768`, or [upgrade the plan](/en/ai-mcp/upgrades/) |
| Fixed port | `EADDRINUSE` | Listen on `process.env.PORT` |
| Missing environment variable | `… is not defined` / `must be set` | Set it with `set_app_env` |
| TypeScript or syntax error | `Type error:`, `SyntaxError:` | Fix the file and line shown |
| npm network | `ETIMEDOUT`, `fetch failed` | Commit `package-lock.json` so the in-country npm mirror is used |

Other recognized causes: conflicting package versions (`ERESOLVE`), a full disk, a missing `build` script or start file, Next.js starting without a build, and database connection errors. Example: "The last deploy failed; find the cause, fix the project and deploy again."

## Errors and fixes

| Error code | Meaning | What to do |
|---|---|---|
| `install_failed` | Installing dependencies failed | Read `get_deployment_logs`; usually an incompatible version or a private package |
| `build_failed` | `npm run build` failed | Read the build log and fix the code error |
| `build_out_of_memory` | The build hit the plan's RAM limit | Make the project lighter or use a higher plan |
| `disk_quota_exceeded` | The account's disk is full | Delete unneeded files in the account or use a plan with more disk |
| `health_check_failed` | The app didn't respond after starting (previous version restored) | Check the runtime log; make sure it listens on `process.env.PORT` |
| `domain_not_owned` | The domain/subdomain isn't on this account | Add it in this service's cPanel |
| `domain_has_other_app` | That path runs an app created manually | Use another path or subdomain |
| `archive_rejected` | Archive has symlinks, `..` paths or special files, or no `package.json` at the root | Upload from the project root with the suggested command |
| `upload_too_large` | Over 50 MB | Exclude `node_modules`, build output and large files |
| `deployment_in_progress` | Another deployment is running | Wait for it to finish |
| `service_not_active` / `service_not_found` | The service isn't active or isn't yours | Renew it or use the right ID |

## Limits

- Uploads up to **50 MB** (without `node_modules`).
- Build and runtime use your plan's resources. Disk speed by plan: Eco 10, Base 20, Pro 30 and Max 50 MB/s.
- Besides the live version, **one previous version** is kept for rollback. If disk space is short, the previous version is removed to make room for the new build, and the deployment status says so.

## Direct cPanel login

`open_cpanel` does what the panel's "Log in to cPanel" button does and works for **all your hosting**. Because the link grants full access, `hosting:login` is a separate permission shown with a warning on the consent screen. Open the link yourself, in your own browser.

## Security

- **Ownership:** only your own services can be targeted; identity comes only from your login token, never from tool input.
- **No root access:** everything runs as your own cPanel user inside your account's isolated environment.
- **Dedicated key:** each service gets its own SSH key that only works from Hostino's server and only for running commands. Your own SSH keys are left untouched.
- **Archives:** symlinks, `..`/absolute paths and special files are rejected before anything reaches the server.
- **Internal files:** only `/_next/static` is published; server code, build output and logs are not reachable from the web.
- **Supply chain:** the in-country mirror is used only when you have a `package-lock.json`; npm checks every package's sha512 hash against the lockfile, so the mirror cannot swap a package.

## FAQ

**Are npm packages installed every time? Isn't Node.js already on the server?**
**Node.js** itself (18/20/22) is installed on the server and is never installed by a deploy. But **each project's dependencies** (`next`, `react`, …) are specific to that project and its versions, so they're installed once per project. When `package-lock.json` and the Node version don't change, later deploys **don't reinstall** them; they reuse the previous version's packages (without using extra disk space).

**What does AI Deploy change in my cPanel account?**
The first time: SSH access for the account is enabled (inside the isolated environment) and a dedicated key is added. Apps live in `~/hostino-apps/<name>` and also appear in cPanel's "Setup Node.js App".

**Can I manage the app from cPanel later?**
Yes. The app runs on cPanel's own Node.js feature. In "Setup Node.js App" you can see its status, stop/start/restart it and add environment variables (kept by later deploys). Just **don't edit the app's files by hand**: every deploy is a fresh copy of your project's source and sets manual file edits aside. Change the Node version with `node_version` when deploying.

**What about an app I created manually in cPanel?**
It's left untouched. AI Deploy only changes apps it created itself.

## Example prompts

- "Deploy this Next.js project to my Node.js hosting."
- "Deploy the app on the subdomain `app.example.com` with Node 22."
- "Publish an Express API on the `/api` path."
- "The last deploy failed; find the cause with `analyze_deployment` and fix it."
- "Set `DATABASE_URL` for the app."
- "Roll back to the previous version."
- "Give me a cPanel login link."

## Next steps

- [Remote MCP and the tool list](/en/ai-mcp/remote-mcp/)
- [Authentication & permissions](/en/ai-mcp/authentication/)
- [Troubleshooting](/en/ai-mcp/troubleshooting/)
