deno-frontend

โดย denoland

ใช้เมื่อทำงานกับ Fresh framework, สร้าง routes หรือ handlers ใน Fresh, สร้างเว็บ UI ด้วย Preact, หรือเพิ่ม Tailwind CSS ใน Deno ครอบคลุม Fresh 2.x…

npx skills add https://github.com/denoland/skills --skill deno-frontend

Frontend development with Deno

Two paths. Pick by what the project already uses.

Regular npm frameworks — the usual choice

Deno runs the normal frontend ecosystem: React, Vue, Svelte, Solid, Vite, Astro, Next.js, Nuxt, SvelteKit, Remix, SolidStart. Nothing needs to be ported, and there is no Deno-specific way to write them.

deno create vite my-app     # or astro, next, nuxt, svelte…
cd my-app
deno install
deno task dev

deno create is npm create. deno install reads package.json. deno task <script> runs package.json scripts. That is the whole difference.

Follow the framework's own documentation for everything else — routing, components, data loading, and config are the framework's concern, not Deno's. Don't invent Deno-flavoured variants of their APIs, and don't reach for Fresh patterns in a React or Svelte project.

The only things worth knowing:

  • Some frameworks need "nodeModulesDir": "auto" in deno.json; Next.js does.
  • Permissions apply to the dev server too — framework tasks generally want -A.
  • Deploying: see the deno-deploy skill, which lists per-framework build commands and presets.

Fresh — Deno's own framework

Fresh suits a new Deno-first project that wants server rendering with minimal client JavaScript. It uses island architecture: pages render on the server, and only components in islands/ ship JavaScript.

deno run -Ar jsr:@fresh/init
cd my-project
deno task dev                # http://localhost:5173

A Fresh project is Vite-based: vite.config.ts for the build, main.ts for the server, file-based routes in routes/, islands in islands/, server-only components in components/. Preact supplies the component model, with signals for state.

// islands/Counter.tsx — interactive, ships JS
import { useSignal } from "@preact/signals";

export default function Counter() {
  const count = useSignal(0);
  return <button onClick={() => count.value++}>Count: {count.value}</button>;
}

Three rules carry most of the weight:

  1. Islands ship JavaScript — keep them small, leave everything else in components/.
  2. Island props must be serializable. Functions cannot be passed.
  3. Handlers take a single (ctx) parameter.

Load references/FRESH.md for routes, handlers, define helpers, middleware, islands, signals, and Tailwind.

Use Fresh 2.x, imported from "fresh". For an existing 1.x project, or one pinned to a 2.0.0-alpha.* release, see references/FRESH_MIGRATION.md.

Further reading

  • https://fresh.deno.dev/docs — Fresh documentation
  • references/FRESH.md — Fresh 2.x patterns in depth
  • references/FRESH_MIGRATION.md — Fresh 1.x and alpha migration

Skills เพิ่มเติมจาก denoland

deno
denoland
ใช้เมื่อเขียน รัน กำหนดค่า ตรวจสอบ หรือดีบักโค้ดในโปรเจกต์ Deno หรือเมื่อสร้างโปรเจกต์ใหม่ ครอบคลุมการจัดการ dependencies ด้วย deno…
deno-deploy
denoland
Use when deploying Deno apps to production, asking about Deno Deploy, or working with `deno deploy` CLI commands. Covers deployment workflows, environment…
deno-expert
denoland
ความรู้ระดับผู้เชี่ยวชาญด้าน Deno สำหรับการตรวจสอบโค้ด การดีบัก และการบังคับใช้แนวปฏิบัติที่ดีที่สุด ใช้เมื่อตรวจสอบโค้ด Deno หรือตอบคำถามขั้นสูงเกี่ยวกับ Deno
deno-guidance
denoland
ใช้เมื่อเริ่มต้นโปรเจกต์ Deno ใดๆ การเลือกแพ็กเกจ การกำหนดค่า deno.json หรือการรันคำสั่ง CLI ให้ความรู้พื้นฐานสำหรับการสร้าง Deno สมัยใหม่…
deno-project-templates
denoland
ใช้เมื่อสร้างโครงโปรเจกต์ Deno ใหม่ มีเทมเพลตสำหรับเว็บแอป Fresh, เครื่องมือ CLI, ไลบรารี และเซิร์ฟเวอร์ API พร้อมแนวปฏิบัติที่ดีที่สุดสมัยใหม่
deno-sandbox
denoland
ใช้เมื่อสร้างฟีเจอร์ที่ต้องรันโค้ดจากผู้ใช้ที่ไม่น่าเชื่อถือ โค้ดที่สร้างโดย AI หรือต้องการสภาพแวดล้อมการรันโค้ดแบบแยกส่วน ครอบคลุม @deno/sandbox SDK
migrate-to-deno
denoland
ใช้เมื่อย้ายโปรเจกต์ Node.js, npm, Yarn, pnpm หรือ Bun ไปยัง Deno หรือเมื่อนำ Deno มาใช้แบบค่อยเป็นค่อยไปในโค้ดเบส JavaScript หรือ TypeScript ที่มีอยู่…
fmt
denoland
จัดรูปแบบโค้ดทั้งหมดใน repository นี้ ควรเรียกใช้ก่อนเปิด PR หรือ commit การเปลี่ยนแปลง