This document provides instructions for running the API with alternative JavaScript runtimes.
- Bun v1.0+
# Install dependencies (Bun can use pnpm lockfile)
bun install
# Generate Prisma client
bunx prisma generate
# Run development server
bun run --filter @myorg/api dev:bun
# Or directly
cd apps/api
bun run src/index.bun.ts- Faster startup: ~3x faster cold start
- Native TypeScript: No transpilation needed
- Built-in WebSocket: Use
Bun.serve()native WebSocket
- ✅ Hono works perfectly with Bun
- ✅ Prisma works with Bun
- ✅ ioredis works with Bun
⚠️ Some Node.js polyfills may be needed⚠️ @hono/node-servershould be replaced with Bun.serve
// Use Bun.serve instead of @hono/node-server
Bun.serve({
port: 3001,
fetch: app.fetch,
websocket: {
open(ws) {
/* ... */
},
message(ws, msg) {
/* ... */
},
close(ws) {
/* ... */
},
},
});- Deno v1.40+
# Run with permissions
deno run \
--allow-net \
--allow-read \
--allow-write \
--allow-env \
apps/api/src/index.deno.tsCreate deno.json in apps/api:
{
"tasks": {
"dev": "deno run --allow-all --watch src/index.deno.ts",
"start": "deno run --allow-all src/index.deno.ts"
},
"imports": {
"hono": "npm:hono@^3.11.0",
"@prisma/client": "npm:@prisma/client@^5.7.0",
"ioredis": "npm:ioredis@^5.3.2"
},
"compilerOptions": {
"strict": true
}
}- ✅ Hono has first-class Deno support
⚠️ Prisma requires special setup for Deno⚠️ Replaceiorediswithdeno-redisfor native support⚠️ File system APIs differ slightly⚠️ wslibrary may need alternatives
| Node.js Package | Deno Alternative |
|---|---|
ioredis |
npm:ioredis or deno.land/x/redis |
ws |
Native Deno.upgradeWebSocket |
bcryptjs |
deno.land/x/bcrypt |
jsonwebtoken |
deno.land/x/djwt |
uuid |
crypto.randomUUID() (built-in) |
# Generate Prisma client for Deno
npx prisma generate --generator client
# Or use Data Proxy
# Set DATABASE_URL to a Prisma Data Proxy URLFor Deno Deploy, use the edge-compatible version:
import { Hono } from 'https://deno.land/x/hono/mod.ts';
const app = new Hono();
app.get('/healthz', (c) => c.json({ status: 'ok' }));
Deno.serve(app.fetch);| Runtime | Cold Start | Memory | npm Compat |
|---|---|---|---|
| Node.js | ~200ms | ~50MB | ✅ Full |
| Bun | ~50ms | ~30MB | ✅ High |
| Deno | ~100ms | ~40MB |
- Node.js: Most stable, full ecosystem support
- Bun: Best for performance-critical workloads
- Deno: Best for edge/serverless deployments
FROM oven/bun:1 AS base
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
EXPOSE 3001
CMD ["bun", "run", "src/index.bun.ts"]FROM denoland/deno:1.40.0
WORKDIR /app
COPY . .
RUN deno cache src/index.deno.ts
USER deno
EXPOSE 3001
CMD ["deno", "run", "--allow-all", "src/index.deno.ts"]