Deno 2 mit Claude Code: Moderne JavaScript-Runtime 2026

Deno 2 ist die sichere, moderne Runtime für JavaScript und TypeScript — TypeScript out of the box, Web-Standard APIs, granulares Permission-System und volle npm-Kompatibilität. Claude Code kennt Deno vollständig und generiert idiomatischen Deno-Code.

Deno 2 Grundlagen und Vorteile

DenoTypeScript nativ — kein Setup nötig

# Prompt: "Erstelle einen HTTP-Server mit Deno 2 und TypeScript" // server.ts — Claude Code generiert, KEIN tsconfig.json nötig! import { Hono } from 'npm:hono' // npm: prefix für npm-Pakete import { cors } from 'npm:hono/cors' const app = new Hono() app.use('*', cors()) app.get('/', (c) => c.json({ message: 'Hello from Deno!', version: Deno.version })) app.get('/users/:id', async (c) => { const id = c.req.param('id') // Deno.KV — eingebaut, kein Redis nötig für kleine Apps! const kv = await Deno.openKv() const user = await kv.get(['users', id]) if (!user.value) return c.json({ error: 'Not found' }, 404) return c.json(user.value) }) // Deno.serve: Web-Standard fetch-basierter Server Deno.serve({ port: 8000 }, app.fetch) # Starten: deno run --allow-net --allow-read server.ts

Permission-System: Sicherheit by Default

SecurityGranulare Permissions

# Deno's Permission-System — kein Code kann ohne Erlaubnis auf Ressourcen zugreifen # Netzwerk erlauben (nur bestimmte Hosts): deno run --allow-net=api.example.com:443 script.ts # Dateisystem (nur Lesen in /tmp): deno run --allow-read=/tmp script.ts # Umgebungsvariablen (nur bestimmte): deno run --allow-env=DATABASE_URL,API_KEY script.ts # deno.json — Permissions konfigurieren: { "tasks": { "start": "deno run --allow-net --allow-env=DATABASE_URL src/main.ts", "dev": "deno run --watch --allow-net --allow-env src/main.ts" }, "imports": { "hono": "npm:hono@^4", "@std/assert": "jsr:@std/assert@^1" // JSR: neue Deno Package Registry } }
Security-Tipp: Beim Code-Review mit Claude Code: "Welche Deno-Permissions braucht dieses Script minimal? Erkläre jeden Permission-Flag." Claude Code analysiert alle Deno-API-Aufrufe und gibt die minimale Permission-Liste zurück.

npm-Kompatibilität in Deno 2

npmNode.js-Pakete in Deno nutzen

# Deno 2: Volle npm-Kompatibilität — bestehende Node.js-Pakete verwenden // Prisma in Deno (npm: prefix): import { PrismaClient } from 'npm:@prisma/client' // Zod Validierung: import { z } from 'npm:zod' // Deno kann auch Node.js-Builtins nutzen: import { readFile } from 'node:fs/promises' import path from 'node:path' # deno.json als Alternative zu package.json: { "imports": { "zod": "npm:zod@^3", "prisma": "npm:@prisma/client" }, "nodeModulesDir": "auto" // node_modules erstellen (für Prisma nötig) }

Deno Deploy: Edge-Deployment

DeployGlobal Edge in Sekunden

# Deno Deploy: GitHub → automatisches Deployment → global Edge # Keine Konfiguration nötig — Deploy erkennt deno.json automatisch # Regionen: 35+ Edge-Standorte weltweit # Deno.KV: globally replicated Key-Value Store inklusive # deployctl CLI: deno install -g jsr:@deno/deployctl deployctl deploy --project=my-api src/main.ts # GitHub Actions Integration: - name: Deploy to Deno Deploy uses: denoland/deployctl@v1 with: project: "my-project" entrypoint: "src/main.ts" root: "." # Deno KV — persistente Daten an der Edge: const kv = await Deno.openKv() await kv.set(['sessions', sessionId], userData, { expireIn: 3600 * 1000 // 1 Stunde TTL }) const session = await kv.get(['sessions', sessionId])

Runtime-Modul im Kurs

Im Claude Code Mastery Kurs: Deno 2 vollständig — Permission-System, Deno KV, JSR, npm-Kompatibilität und Deno Deploy für globale Edge-Anwendungen.

14 Tage kostenlos testen →