Deploying a site
The CLI writes each host's config (one HTTPS address, security headers, cache), the contact form sender that runs there, and prints the secret and domain steps. With --publish it also runs the host's own CLI, after showing exactly what will run and asking.
The flow
npx vamos-ui site form # the contact form sender for this host
npx vamos-ui site deploy --domain ornek.com.tr # host config + steps + secret commands
npx vamos-ui site deploy --publish # optional: run the host CLI after a confirmation
npx vamos-ui site check # audit + deploy checks on the live addressThe host comes from --host, else from the plan in vamos.project.json (npx vamos-ui new asks where the site will run). Neither command replaces a file that already exists, and nothing is published without --publish and your yes.
Hosts
| Host | Build | Config written | Contact form |
|---|---|---|---|
| Vercel | Next.js server | vercel.json | resend or smtp server action |
| Cloudflare Pages | static export (out) | public/_headers, public/_redirects | edge: functions/api/contact.ts |
| Spacefast | static export, or server on Next 16.2.x / 16.3.x / 15.5.24+ | public/_headers, public/_redirects | edge: functions/api/contact.ts |
| Netlify | Next.js server | public/_headers, public/_redirects | resend or smtp |
| cPanel / Plesk | static export (out) | public/.htaccess | php-mail: public/contact.php |
| VPS | Next.js standalone on pm2 | deploy/nginx-<domain>.conf, deploy/ecosystem.config.cjs | resend or smtp |
Vercel
- Import the Git repository (framework: Next.js), or run
npx vamos-ui site deploy --publish, which runsnpx vercel deploy --prod. vercel.jsonsends the security headers, caches/_next/staticfor a year and 301s the other host name.
Cloudflare Pages
Set output: "export" (and images: { unoptimized: true } or a loader) in next.config, then build and upload out/ from the project root, so functions/ deploys with it:
npm run build
npx wrangler pages deploy out --project-name defter-hesapA site that needs a Next.js server (a shop) deploys as a Worker through the OpenNext adapter instead (@opennextjs/cloudflare); --publish only handles the static export.
Spacefast
sf publish detects a Next.js project, builds it and uploads out. Server rendering works only on the versions its bundled adapter supports; site deploy reads the installed version and picks the mode:
| Next.js | Server-rendered | What site deploy does |
|---|---|---|
| 16.2.x, 16.3.x, 15.5.24+ | Yes | sf publish |
| 14.2, 15.0–15.5.23, 16.0, 16.1, 16.4 | No (export only) | output: "export", build, sf publish ./out --prebuilt |
| Anything else, prereleases | No | build the export yourself, sf publish ./out --prebuilt |
- New apps from
vamos-ui createdepend onnext@^16.0.0, which currently installs 16.4, so on Spacefast they publish as a static export. That is what a kit website needs; pin~16.3.0yourself only if you need server rendering there. - With the edge form,
functions/is copied intoout/before the upload so the/api/contactroute publishes with the site. - Spacefast reads
_headersand_redirects, so the same files as Cloudflare apply. Every plan allows commercial use; the datacenter can be Amsterdam. - Publish signed in (
sf login). An anonymous, unclaimed Space can only call a short list of APIs, so the form could not reach Resend.
Netlify, cPanel, VPS
These keep their printed steps (no --publish): Netlify imports from Git; on cPanel you upload the contents of out/ to public_html (the .htaccess and contact.php go with it); on a VPS, nginx with a certbot certificate proxies to Next.js on pm2.
Contact form senders
npx vamos-ui site form writes the sender behind ContactForm and one field list shared by the page and the sender. The kind comes from --kind, else the plan, else the project: a static export on Cloudflare Pages or Spacefast gets edge, another static export php-mail, a Next.js server smtp.
| Kind | File | Form action | Sends with |
|---|---|---|---|
edge | functions/api/contact.ts | "/api/contact" | Resend HTTP API |
php-mail | public/contact.php | "/contact.php" | The host's mail server |
resend | app/actions/contact.ts | {sendContact} | Resend HTTP API |
smtp | app/actions/contact.ts | {sendContact} | Your own mailbox (nodemailer) |
Every sender validates the same fields, requires the privacy notice (KVKK) consent when the form shows the checkbox, drops honeypot and too-fast submits with a fake success, refuses cross-site posts, rate-limits per IP and puts no visitor input into mail headers except a checked Reply-To.
The edge function
One file runs on both hosts: it exports onRequestPost for Cloudflare Pages Functions and POST for the Spacefast file router, and uses only fetch, Request and Response.
import { contactFields, privacyCheckbox } from "@/app/contact-fields";
<ContactForm
action="/api/contact"
fields={contactFields}
privacyLink={{ href: "/kvkk", label: "KVKK Aydınlatma Metni" }}
privacyCheckbox={privacyCheckbox}
turnstileSiteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}
/>| Answer | When |
|---|---|
200 { ok: true, status: "success" } | Sent (or a bot was quietly dropped). Without JavaScript: a 303 back to the page with ?vb_sent=<form>. |
422 { status: "invalid", errors } | A field is missing, too long or malformed, or the consent box is not ticked. |
403 | Cross-site post, or the Turnstile check failed. |
429 | More than 5 messages from one IP in 10 minutes (Retry-After: 600). |
400 / 405 / 413 / 415 | Unreadable body, not a POST, over 32 KB, or an unsupported content type. |
500 / 502 | A secret is not set, or Resend refused the message. The log names the variable, never its value. |
/api/contact, or turn on Turnstile.Turnstile
Optional, for every sender except php-mail. Create a Turnstile widget for the domain in the Cloudflare dashboard, give the site key to the build as NEXT_PUBLIC_TURNSTILE_SITE_KEY and the secret to the host as TURNSTILE_SECRET. ContactForm loads the Turnstile script only when it has a site key; the sender checks the token with Cloudflare's siteverify API and refuses a submit without one while the secret is set. Turnstile needs JavaScript, so a no-JS submit is refused then.
Secrets
site deploy and site form print the command for each secret. None of them puts the value on the command line: the host CLI asks for it, so it stays out of your shell history. Never commit them.
| Host | Command |
|---|---|
| Vercel | npx vercel env add RESEND_API_KEY production |
| Cloudflare Pages | npx wrangler pages secret put RESEND_API_KEY --project-name defter-hesap |
| Spacefast | sf env set RESEND_API_KEY --value-from-stdin --space defter-hesap |
| cPanel | CONTACT_TO / CONTACT_FROM inside public/contact.php (no secret) |
The edge and Resend senders read RESEND_API_KEY, CONTACT_TO (comma-separated for several inboxes), CONTACT_FROM (an address on a domain verified in Resend) and the optional TURNSTILE_SECRET; SMTP adds SMTP_HOST, SMTP_PORT, SMTP_USER and SMTP_PASS.
Domain records
| Host | Add the domain | DNS |
|---|---|---|
| Vercel | Project → Settings → Domains | A 76.76.21.21 for the bare domain, CNAME for www (as Vercel shows). |
| Cloudflare Pages | Custom domains | Created for you when the zone is on Cloudflare. SSL/TLS: Full (strict), Always Use HTTPS on. |
| Spacefast | sf domains add ornek.com.tr --space defter-hesap | The A / CNAME records it prints; HTTPS is issued automatically. |
| cPanel | Addon domain / the account's main domain | The host's nameservers or A record; AutoSSL before the HTTPS redirect goes live. |
| VPS | nginx server_name | A (and AAAA) to the server; certbot --nginx for the certificate. |
Pass --domain (and --www to serve on www) so the redirect from the other host name is written for you.
site deploy --publish
For Vercel, Cloudflare Pages and Spacefast, --publish runs the host's CLI after writing the files. It first shows the host, the project or Space, the directory and every command, then asks (the default answer is no). In CI or another non-interactive run it publishes only with --yes. If the CLI is missing or you are not signed in it prints the install or login command (npx vercel login, npx wrangler login, sf login) and stops.
npx vamos-ui site deploy --host spacefast --space defter-hesap --publish
# Host: spacefast
# Target: Spacefast Space defter-hesap
# Directory: out
# 1. npm run build
# 2. cp -R functions out/functions
# 3. sf publish ./out --prebuilt --space defter-hesap
# ◆ Publish to spacefast now? No / Yes
npx vamos-ui site deploy --host cloudflare --project defter-hesap --publish --yes # CI
npx vamos-ui site deploy --publish --dry-run # show the plan onlyAfter the deploy
npx vamos-ui site check runs the audit on the live URL plus the deploy checks: http → https, one host name, the security headers (and every header your public/_headers sets), a real 404, robots.txt and sitemap.xml. With a form sender in the project it also sends an empty POST to its endpoint (/api/contact or /contact.php, or --form-endpoint): a 400, 405, 415 or 422 proves the route is live, a 404 means the function did not deploy. The empty request never passes validation, so nothing is sent. Then send one real message and check the inbox and the spam folder.