SSR-Enabled Hosting With an Adapter
Server Deployment
Server mode produces a runtime entry. Combined with the right adapter, deploy to Vercel, Netlify, Cloudflare, or your own Node server.
What you'll learn
- Build a server-mode project
- Deploy to Vercel/Netlify/Cloudflare
- Run a standalone Node server
Server-mode Astro sites need a runtime to handle requests. The adapter (chapter 6 lesson) targets a specific runtime. Deployment varies per host.
With Vercel / Netlify / Cloudflare
If you used npx astro add vercel|netlify|cloudflare, deployment
is the same as static — push to GitHub, host detects Astro, deploys.
The build:
- Generates static assets (prerendered pages, images, CSS)
- Generates the server function(s) for dynamic routes
Each host’s UI lets you set environment variables per environment.
Node Standalone
@astrojs/node with mode: "standalone" builds a Node server you
run directly:
npm run build
node ./dist/server/entry.mjs Behind a reverse proxy (nginx, Caddy), this works fine on any VPS. You’re responsible for process management (PM2, systemd) and SSL.
Docker
Astro plays well with Docker. A simple Dockerfile:
FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-slim
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./package.json
ENV HOST=0.0.0.0 PORT=8080
EXPOSE 8080
CMD ["node", "./dist/server/entry.mjs"] Environment Variables
Set them in the host’s UI (Vercel/Netlify) or your container runtime. Don’t commit them.
For typed env, the astro:env schema (chapter 6) gives you
build-time validation — missing required vars fail the build, not
runtime.
Edge Considerations
Cloudflare Workers and Vercel Edge are restricted runtimes:
- No
fs - Limited Node compat
- 10–30 MB bundle limits
- Some packages (image processing, native modules) won’t work
If you need full Node, pick a Node target rather than edge.
Up Next
Where to go after the fundamentals.
Going Further →