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 .eco directory.
bun run buildThis command will:
- Set
NODE_ENV=production. - Clean the
.ecodirectory. - Generate static HTML for all files in
src/pages. - 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 .eco/public (or similar output) directory on any static provider.
- Vercel / Netlify: Connect your repository and set the build command to
bun run build. Set the output directory to.eco. - GitHub Pages: Use a GitHub Action to run
bun 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 that supports Bun.
1. Using bun run start
After building, you can start the production server:
bun run start2. Docker Deployment
You can easily containerize your Ecopages app using the official Bun image.
FROM oven/bun:latest
WORKDIR /app
COPY package.json bun.lockb ./
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) |