Deploy a frontend app (SSR)
This guide covers deploying server-side rendered frontends — Next.js, Nuxt, SvelteKit, Remix, and Astro — to Cloud Run with advncd.
For static SPA apps (Vite, CRA), Cloud Run works but a static host (Vercel, Netlify, Firebase Hosting) is usually a better fit. This guide focuses on SSR apps that need a server process.
Prerequisites
- advncd installed and authenticated (
advncd login) - A GCP project configured (
advncd init) - Required APIs enabled (
advncd apis enable)
1. Check detection
advncd detect --path .
Expected output for a Next.js app:
runtime: nodejs
build strategy: buildpacks
port: 3000
confidence: high
warnings: none
service name proposal: my-nextjs-app
2. Make sure your app reads PORT
Cloud Run injects PORT at runtime. Most frameworks read it automatically, but check your start command.
Next.js — reads PORT by default. No changes needed.
Nuxt — reads PORT by default.
SvelteKit (Node adapter) — set the PORT env in your start script:
// server.js (if using custom server)
const port = process.env.PORT || 3000;
Remix — reads PORT by default when using the Node adapter.
3. Deploy
advncd deploy --path . --name my-nextjs-app
From outside the app directory:
advncd deploy --path /path/to/nextjs-app --name my-nextjs-app
4. Verify
advncd services describe my-nextjs-app
advncd services open my-nextjs-app
advncd.yaml
version: 1
service:
name: my-nextjs-app
port: 3000
deploy:
project: my-gcp-project
region: europe-west1
allow_service_rename: false
build:
strategy: buildpacks
runtime:
family: nodejs
framework: nextjs
Environment variables
For Next.js, NEXT_PUBLIC_* variables are baked in at build time. Set them in .env.production at the project root — advncd picks this file up automatically.
Server-only variables (API keys, database URLs) go in env.required or env.optional in advncd.yaml:
env:
required:
- DATABASE_URL
- NEXTAUTH_SECRET
optional:
- SENTRY_DSN
Monorepo example
# Deploy web frontend
advncd deploy --path ./apps/web --name web-frontend
# Deploy API (separate service)
advncd deploy --path ./apps/api --name backend-api
Each service scales independently on Cloud Run.