On this page

Deno

Guara Cloud fully supports Deno applications, including frameworks like Fresh, Oak, Hono, and any other Deno-based project. Deno’s secure-by-default runtime and native TypeScript support make it a great choice for modern web applications.

Supported versions

The following Deno versions are auto-detected by Buildpack:

  • Deno 1.46
  • Deno 2.0
  • Deno 2.1

The version is determined from the deno.json or deno.jsonc configuration file. If no version is specified, the latest stable version is used.

{
  "lock": true,
  "tasks": {
    "start": "deno run --allow-net --allow-read --allow-env main.ts"
  }
}

Deploy with Dockerfile

For full control over your build, provide a Dockerfile in the root of your repository.

FROM denoland/deno:2.1

WORKDIR /app

COPY deno.json deno.lock ./
RUN deno install

COPY . .
RUN deno cache main.ts

EXPOSE 3000

CMD ["deno", "run", "--allow-net", "--allow-read", "--allow-env", "main.ts"]

Deploy with Buildpack

If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Deno project by the presence of a deno.json or deno.jsonc file in the root directory.

The Buildpack will:

  1. Detect the Deno version from your configuration
  2. Cache dependencies defined in your import map or deno.json
  3. Build your application if a build task is defined
  4. Start your application using the start task

Make sure your deno.json includes a start task:

{
  "tasks": {
    "start": "deno run --allow-net --allow-read --allow-env main.ts"
  }
}

Port configuration

Your application must listen on the port configured in your service settings. The default is 3000, but you can change it at any time to match your application.

const port = Number(Deno.env.get("PORT")) || 3000;
Deno.serve({ port }, handler);

Example project structure

my-deno-app/
  deno.json
  deno.lock
  main.ts
  routes/
    index.ts
  middleware/
    auth.ts
  Dockerfile          # optional — omit to use Buildpack

Environment variables

These environment variables are commonly used with Deno deployments:

VariableRecommended valueDescription
PORTSet by platformThe port your application must listen on
DENO_ENVproductionIndicates the runtime environment
DENO_DIR/app/.cache/denoDirectory for Deno’s module cache

Common pitfalls