Deploy Next.js on a VPS with an AI assistant
An assistant with its own terminal builds your Next.js or Node app on a Cloudvix server and runs it behind Caddy with HTTPS. You answer about the price, the domain and any keys only you have.
Tell your assistant
Copy this one sentence into an assistant with its own terminal. It adds the Cloudvix server itself with its own command, you approve the access once in your browser, and it then sets up the project. A chat app without a terminal cannot add a connector itself: you add the address once as the steps below show, and it can then order and manage servers but not set one up over SSH.
Connect the Cloudvix MCP server at https://mcp.cloudvix.com/mcp to yourself with your own MCP command (I approve the access in my browser), then set up my Next.js app on a Cloudvix server: start with help_get ssh_for_ai, decide the technical details yourself (Docker with Caddy is a suggestion), ask me only about the price, the domain and things only I can know, and give me one short report at the end.Server address
https://mcp.cloudvix.com/mcpTransport: Streamable HTTP. Sign-in: OAuth in your browser.
If your assistant cannot do it itself
The same connection, step by step, to do by hand.
Before you start
- A Cloudvix account and an assistant with its own terminal and SSH, such as Claude Code, Codex, Cursor or VS Code, connected to Cloudvix as described in Connect an assistant. A chat without a terminal can only order and manage servers.
- Your project in a git repository or a folder, with a
package.json, and a domain if you want one.
Steps
Step 1: Give your assistant one sentence
Copy the sentence into your assistant. It reads the Cloudvix help text
ssh_for_aifor assistants, decides the technical details itself and asks you only about the price, the domain and things only you can know. At the end you get one short report.Prompttext Set up my project on a Cloudvix server. Start with help_get ssh_for_ai, decide the technical details yourself, ask me only about the price, the domain and things only I can know, and give me one short report at the end.Step 2: What the assistant does in the first hour
Before any software of your project goes on, it sets the server up safely:
- It creates a new SSH key for this one server and sends only the public half to Cloudvix. The private key stays on your computer.
- It signs in as root with that key, turns off password sign-in and checks that with a command.
- It closes all incoming ports except 22, 80 and 443.
- It switches on automatic security updates; a restart, when one is needed, happens at 04:00 server time.
- It writes notes about the server to the file
/root/SERVER-NOTES.mdon the server.
Step 3: The setup it suggests
We ran this setup on 23 November 2026 on a new Quartz server with Ubuntu 24.04: a minimal Next.js app with
output: "standalone"built in under a minute and answered from the internet through Caddy, while port 3000 stayed closed from outside. We did not build a large project, and a bigger build may need more memory than 2 GB. Docker with Caddy is a suggestion, not a requirement; if your project already has its own setup, the assistant keeps it. The usual shape: a multi-stage image on the current Node LTS that runs as a normal user, with Caddy in front as the only thing published to the internet. The assistant checks the current LTS version on the day it installs and pins its number. For Next.js,output: "standalone"innext.configkeeps the image small. A sketch:Dockerfiletext FROM node:<LTS version>-slim AS build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build FROM node:<LTS version>-slim WORKDIR /app ENV NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0 COPY --from=build /app/.next/standalone ./ COPY --from=build /app/.next/static ./.next/static COPY --from=build /app/public ./public USER node CMD ["node", "server.js"]compose.yamlyaml services: caddy: image: caddy:2 restart: unless-stopped ports: ["80:80", "443:443", "443:443/udp"] volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config app: build: . restart: unless-stopped env_file: .env volumes: caddy_data: caddy_config:Caddyfilecaddy example.org { encode zstd gzip reverse_proxy app:3000 }Step 4: Why only Caddy is published
Docker publishes a port to the whole internet and goes around the firewall rules. So the assistant publishes only Caddy (80 and 443). The app has no
ports:entry and is reached only over the private Compose network.Step 5: Keys and secrets
Settings go into a
.envfile next to the compose file that only root can read and that never enters git. The assistant generates passwords itself on the server and does not print them. Keys of third-party services you put into a file on your own computer, not into the chat; the assistant copies the file to the server without reading it. More in secrets and .env files.Step 6: If the app has a database
It runs in its own container on a private network and is never opened to the internet. The assistant sets a nightly dump on the server, keeps seven daily and four weekly dumps and pulls the latest dump to your computer when it visits. It takes a snapshot before risky work. A snapshot lives with the server and is deleted with it, so it is not a backup.
Step 7: Point your domain at the server
The assistant cannot change the DNS settings of your domain. It tells you the IP address of the server and one record to add: an A record for your domain. It checks the record before it asks for the certificate; Caddy then renews the HTTPS certificate itself. Without a domain, it starts the site on the IP address.
Step 8: Publish a new version
Ask the assistant to publish. It tags the new image with a version or commit, keeps the previous image, takes a dump before a database migration, starts the new version and waits until the app reports healthy. Then it checks the site from outside over HTTPS. If the site does not answer, the assistant goes back to the previous tag with one command that it has written in the notes.
Step 9: Have it checked regularly
Paste the second sentence once a week if the site is live, otherwise once a month. The assistant reads its notes, applies pending updates, fixes what is safe to fix and reports in a few lines: fine, fixed, needs your decision.
Prompttext Check my Cloudvix server <name>. Follow help_get server_checkup: read the notes file on the server, apply pending updates, fix what is safe, and report in a few lines: fine, fixed, needs my decision.Step 10: What it costs while the server runs
Before it orders, the assistant tells you the price per hour, per day and at most per month, excluding VAT, and waits for your yes. A stopped server is billed like a running one; only deleting ends the cost. Before it deletes anything the assistant asks you, and you name what is to be deleted.
If something goes wrong
The build runs out of memory
A Node build needs more memory than the smallest servers have. Tell the assistant; it brings the memory figures, names the next size and its price and waits for your yes. A server keeps its size, so it sets up a new server, moves the data and deletes the old one only after your yes.
The site shows a 502 error
Caddy is running but the app behind it is not. Ask the assistant to look: it reads the app's log, restarts it and, if the new version does not start, goes back to the previous one.
A page works locally but not on the server
Usually a setting from your own .env is missing on the server. Give the assistant the names of the variables; it checks that each one is set without printing the values.