Deno Deploy
The recommended way to deploy Fresh is by using Deno Deploy. It will automatically create branch previews for pull requests, collect request and HTTP metrics, as well as collect traces for you out of the box.
Setup
- Log in to Deno Deploy
- Create a new app
- Link your GitHub repository
- Pick the “Fresh” preset if it’s not already detected automatically
Every time you merge into the main branch a new production deployment will be
created.
Build step
Deno Deploy runs deno task build automatically during deployment when the
Fresh preset is selected. Make sure your deno.json has the correct build task:
{
"tasks": {
"build": "vite build",
"start": "deno serve -A _fresh/server.js"
}
}Environment variables
You can set environment variables in the Deno Deploy dashboard under your
project’s Settings > Environment Variables section. These are available at
runtime via Deno.env.get().
For variables that need to be available in island code
(client-side), prefix them with FRESH_PUBLIC_ - see
Environment Variables.
Custom domains
Custom domains can be configured in the Deno Deploy dashboard under your project’s Settings > Domains section. Deno Deploy automatically provisions TLS certificates for your domains.
Troubleshooting
If your deployment fails to start:
- Ensure
deno task buildhas been run (check that the Fresh preset is selected) - Verify your entry point is
_fresh/server.js, notmain.ts- Fresh 2 generates the server entry during the build step - Check the deployment logs in the Deno Deploy dashboard for specific errors
See the Deno Deploy documentation for more details.