Skip to main content
This guide will help you deploy a Deno application on Zerops quickly.

Prerequisites

Deploy Using a Recipe

1

Log in to Zerops

Navigate to app.zerops.io.
2

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
3

Wait for deployment

Zerops will build and deploy automatically (2-3 minutes).
4

Access your app

Open the subdomain URL from the IP addresses & Public Routing section.

Deploy Your Own Deno App

1. Create a Deno Service

  1. Click Add new service
  2. Select Deno
  3. Choose version (1 or latest)
  4. Set hostname (e.g., “api”)

2. Create Your Deno Application

server.ts
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.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

  1. Push code to Git repository
  2. In Zerops: DeployFrom Git
  3. Enter repository URL

Connect to PostgreSQL

Add Database Service

services:
  - hostname: db
    type: postgresql@16
    mode: NON_HA

Use in Your App

server.ts
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

  1. Go to service settings
  2. Environment Variables
  3. Add variables

Next Steps

Build Pipeline Configuration

Learn how to configure builds with zerops.yaml.

Build docs developers (and LLMs) love