Deployment
Deploying an Ecopages application depends on whether you are using only static features or if you've added API routes and server-side logic.
Production Build
Before deploying, you must create a production build. This processes your assets, pre-renders static pages, and prepares the dist directory.
For projects using the Vite host plugin, ecopages build still produces the same dist output; Vite orchestrates dev and optional build integration only.
pnpm run buildThis command will:
- Set
NODE_ENV=production. - Clean the
distdirectory. - Generate static HTML for all files in
src/pages. - Write
robots.txt(and optionalsitemap.xmlwhen enabled — see Sitemap). - Process images and CSS.
- Collect all necessary server-side files.
Static Hosting
If your site does not use API routes or programmatic server logic, you can host the contents of the dist directory on any static provider.
- Vercel / Netlify: Connect your repository and set the build command to
pnpm run build. Set the output directory todist. - GitHub Pages: Use a GitHub Action to run
pnpm run buildand deploy the output directory.
Server Hosting (Node/Bun)
If your application uses API routes or dynamic server logic, you need a runtime environment compatible with the adapter you configured (Bun or Node).
1. Using pnpm run start
After building, you can start the production server:
pnpm run start2. Docker Deployment
You can easily containerize your Ecopages app using the official Bun image when using the Bun adapter.
FROM oven/bun:latest
WORKDIR /app
COPY package.json ./
RUN bun install --production
COPY . .
RUN bun run build
EXPOSE 3000
CMD ["bun", "run", "start"]3. VPS / PaaS (Railway, Fly.io)
Deploy the server by pointing the platform to your app.ts as the entry point and ensuring it runs with the start command in production.
Environment Check
Before going live, check that these environment variables are set on your hosting provider:
| Variable | Recommended Value |
|---|---|
NODE_ENV | production |
ECOPAGES_BASE_URL | Your production domain (e.g., https://example.com) |
ECOPAGES_PORT | The port required by your host (e.g., 8080) |
ECOPAGES_HOSTNAME | 0.0.0.0 (for Docker/Cloud environments) |