A Deno application with Oak framework ready to deploy on Convox.
This example demonstrates how to deploy a modern Deno application on Convox. It showcases TypeScript support, web standard APIs, the Oak framework for routing, and JSON API endpoints - everything you need for building modern server applications.
Deploy to Convox Cloud for a fully-managed platform experience, or to your own Convox Rack for complete control over your infrastructure. Either way, you'll get automatic SSL, load balancing, and zero-downtime deployments out of the box.
-
Create a Cloud Machine at console.convox.com
-
Create the app:
convox cloud apps create deno -i your-machine-name- Deploy the app:
convox cloud deploy -a deno -i your-machine-name- View your app:
convox cloud services -a deno -i your-machine-nameVisit your URL to see the Deno application!
- Create the app:
convox apps create deno- Deploy the app:
convox deploy -a deno- View your app:
convox services -a denoVisit your URL to see the Deno application!
- Deno 2.0 - Modern JavaScript/TypeScript runtime
- Oak Framework - Express-like web framework for Deno
- TypeScript Native - No compilation step needed
- Secure by Default - Explicit permissions model
- Web Standards - Fetch API, Web Crypto, and more
- ES Modules - Modern module system
GET /- Homepage with environment infoGET /health- Health check endpointGET /api/status- System status JSONGET /api/info- Runtime information JSONPOST /api/echo- Echo back JSON data
# Check health
curl https://your-app-url/health
# Get status
curl https://your-app-url/api/status
# Get system info
curl https://your-app-url/api/info
# Test POST endpoint
curl -X POST https://your-app-url/api/echo \
-H "Content-Type: application/json" \
-d '{"message": "Hello from Deno!"}'# Install Deno (if not installed)
curl -fsSL https://deno.land/install.sh | sh
# Run locally
deno run --allow-net --allow-env --allow-read main.ts
# Run with watch mode
deno run --allow-net --allow-env --allow-read --watch main.tsVisit http://localhost:8080 to see your app running locally.
.
├── Dockerfile # Deno 2.0 Docker image
├── convox.yml # Convox configuration
├── deps.ts # Dependency management
└── main.ts # Main application file
convox cloud scale app --count 2 --cpu 500 --memory 1024 -a deno -i your-machine-nameconvox scale app --count 2 --cpu 500 --memory 1024 -a denoSet custom environment variables:
convox cloud env set API_KEY=secret DATABASE_URL=postgres://... -a deno -i your-machine-nameconvox env set API_KEY=secret DATABASE_URL=postgres://... -a denoCloud:
convox cloud logs -a deno -i your-machine-nameRack:
convox logs -a denoCloud:
convox cloud run app "deno --version" -a deno -i your-machine-nameRack:
convox run app "deno --version" -a denoCloud:
convox cloud run app "deno repl" -a deno -i your-machine-nameRack:
convox run app "deno repl" -a denoDeno uses URL imports. Add new dependencies to deps.ts:
// deps.ts
export { serve } from "https://deno.land/[email protected]/http/server.ts";
export { DB } from "https://deno.land/x/[email protected]/mod.ts";Then import in your code:
import { serve, DB } from "./deps.ts";Create test files with .test.ts suffix:
// main.test.ts
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
Deno.test("example test", () => {
assertEquals(1 + 1, 2);
});Run tests locally:
deno test --allow-allDeno requires explicit permissions. The Dockerfile grants:
--allow-net- Network access--allow-env- Environment variable access--allow-read- File system read access
deno fmtdeno lintdeno bundle main.ts bundle.js- Use
deno compilefor single binary deployments - Enable
--unstable-sloppy-importsfor Node.js compatibility - Use Web Workers for CPU-intensive tasks
- Leverage Deno KV for built-in persistence (when available)
Deno supports many Node.js packages via npm specifiers:
import express from "npm:express@4";Or use the Node.js compatibility layer:
import { createRequire } from "https://deno.land/[email protected]/node/module.ts";
const require = createRequire(import.meta.url);
const express = require("express");