This guide will help you deploy a Deno application on Zerops quickly.
Prerequisites
Deploy Using a Recipe
Import the project
Click Import a project and paste: project :
name : my-deno-app
tags :
- deno
services :
- hostname : api
type : deno@1
enableSubdomainAccess : true
buildFromGit : https://github.com/zeropsio/recipe-deno
- hostname : db
type : postgresql@16
mode : NON_HA
priority : 1
Wait for deployment
Zerops will build and deploy automatically (2-3 minutes).
Access your app
Open the subdomain URL from the IP addresses & Public Routing section.
Deploy Your Own Deno App
1. Create a Deno Service
Click Add new service
Select Deno
Choose version (1 or latest)
Set hostname (e.g., “api”)
project :
name : my-project
services :
- hostname : api
type : deno@1
minContainers : 1
maxContainers : 6
zcli project project-import description.yaml
2. Create Your Deno Application
import { serve } from "https://deno.land/[email protected] /http/server.ts" ;
const handler = ( req : Request ) : Response => {
return new Response ( "Hello from Deno on Zerops!" );
};
const port = parseInt ( Deno . env . get ( "PORT" ) || "8000" );
serve ( handler , { port });
3. Add zerops.yaml
zerops :
- setup : api
build :
base : deno@1
buildCommands :
- deno cache server.ts
deployFiles :
- server.ts
run :
base : deno@1
ports :
- port : 8000
httpSupport : true
start : deno run --allow-net --allow-env server.ts
4. Deploy
Push code to Git repository
In Zerops: Deploy → From Git
Enter repository URL
Connect to PostgreSQL
Add Database Service
services :
- hostname : db
type : postgresql@16
mode : NON_HA
Use in Your App
import { Client } from "https://deno.land/x/[email protected] /mod.ts" ;
const client = new Client ({
hostname: "db" , // Service hostname
port: 5432 ,
user: "db" ,
password: Deno . env . get ( "DB_PASSWORD" ),
database: "db" ,
});
await client . connect ();
const result = await client . queryObject `
SELECT NOW() as time
` ;
console . log ( result . rows [ 0 ]);
Services in the same project communicate via private network using hostnames.
Deno Permissions
Deno requires explicit permissions. Common flags:
run :
start : >
deno run
--allow-net
--allow-env
--allow-read
server.ts
--allow-net Network access (required for HTTP servers)
--allow-env Environment variable access
--allow-read File system read access
--allow-write File system write access
Environment Variables
Go to service settings
Environment Variables
Add variables
run :
envVariables :
DENO_ENV : production
API_URL : https://api.example.com
Next Steps
Build Pipeline Configuration Learn how to configure builds with zerops.yaml.