Claude Code for Deno and Fresh: Server-Side Rendering Without Build Steps — Claude Skills 360 Blog
Blog / TypeScript / Claude Code for Deno and Fresh: Server-Side Rendering Without Build Steps
TypeScript

Claude Code for Deno and Fresh: Server-Side Rendering Without Build Steps

Published: December 10, 2026
Read time: 8 min read
By: Claude Skills 360

Deno is a secure JavaScript/TypeScript runtime with built-in TypeScript support, a URL-based module system, and permission-based security. Fresh is Deno’s full-stack web framework — it renders HTML on the server with no JavaScript by default, and “islands” opt into client-side interactivity only where needed. Deno Deploy hosts Fresh apps globally on CDN edge nodes. Claude Code generates Fresh routes, island components, Deno KV queries, and the deno.json task configuration.

CLAUDE.md for Fresh Projects

## Fresh Stack
- Deno 2.x + Fresh 2.x
- UI: Preact components (Fresh default) with TypeScript
- Styling: Tailwind CSS (Fresh plugin)
- Persistence: Deno KV (built-in key-value store)
- Deploy: Deno Deploy (zero config — push to GitHub → auto-deploy)
- Islands: client-interactive components only — everything else is server-rendered
- Auth: deno_kv_oauth (GitHub/Google OAuth via sessions in KV)
- No node_modules: all deps via JSR (jsr:) or esm.sh (https://)

Project Structure

fresh-project/
├── deno.json            # Config + tasks + imports map
├── main.ts              # Entry point
├── dev.ts               # Dev server with HMR
├── fresh.config.ts      # Fresh plugin config
├── routes/
│   ├── _app.tsx         # Global layout
│   ├── _middleware.ts   # Auth middleware
│   ├── index.tsx        # Home page (/)
│   ├── orders/
│   │   ├── index.tsx    # /orders
│   │   └── [id].tsx     # /orders/:id
│   └── api/
│       └── orders.ts    # /api/orders (REST endpoint)
├── islands/
│   ├── OrderForm.tsx    # Interactive form (client JS)
│   └── SearchBar.tsx    # Interactive search
└── components/
    └── OrderCard.tsx    # Server-rendered component

Fresh Route

// routes/orders/index.tsx — server-rendered orders list
import type { PageProps, Handlers } from '$fresh/server.ts';
import { OrderCard } from '../../components/OrderCard.tsx';
import SearchBar from '../../islands/SearchBar.tsx';
import { db } from '../../lib/db.ts';

interface Order {
    id: string;
    customerName: string;
    status: string;
    totalCents: number;
    createdAt: string;
}

interface PageData {
    orders: Order[];
    query: string;
}

// Server-side handler: runs on every request, never sent to client
export const handler: Handlers<PageData> = {
    async GET(req, ctx) {
        const url = new URL(req.url);
        const query = url.searchParams.get('q') ?? '';
        
        const orders = await db.orders.list(query);
        
        return ctx.render({ orders, query });
    },
    
    async POST(req) {
        const body = await req.formData();
        const orderId = body.get('cancel_order_id') as string;
        
        if (orderId) {
            await db.orders.cancel(orderId);
        }
        
        return new Response(null, {
            status: 303,
            headers: { Location: '/orders' },
        });
    },
};

export default function OrdersPage({ data }: PageProps<PageData>) {
    const { orders, query } = data;
    
    return (
        <div class="container mx-auto p-6">
            <div class="flex justify-between items-center mb-6">
                <h1 class="text-2xl font-bold">Orders</h1>
                <a href="/orders/new" class="btn btn-primary">New Order</a>
            </div>
            
            {/* Island: only this component has client-side JS */}
            <SearchBar initialQuery={query} />
            
            {orders.length === 0 ? (
                <p class="text-center text-gray-500 py-12">No orders found.</p>
            ) : (
                <div class="grid gap-4">
                    {orders.map(order => (
                        <OrderCard key={order.id} order={order} />
                    ))}
                </div>
            )}
        </div>
    );
}

Islands (Client-Side Interactivity)

// islands/SearchBar.tsx — client-side search with debounce
import { useSignal, useComputed } from '@preact/signals';
import { useEffect } from 'preact/hooks';

interface SearchBarProps {
    initialQuery: string;
}

export default function SearchBar({ initialQuery }: SearchBarProps) {
    const query = useSignal(initialQuery);
    
    // Debounced navigation
    useEffect(() => {
        const timeoutId = setTimeout(() => {
            const url = new URL(window.location.href);
            if (query.value) {
                url.searchParams.set('q', query.value);
            } else {
                url.searchParams.delete('q');
            }
            // Use replaceState for debounced search (don't add to history)
            window.history.replaceState({}, '', url.toString());
            // Reload to trigger server-side search
            window.location.reload();
        }, 300);
        
        return () => clearTimeout(timeoutId);
    }, [query.value]);
    
    return (
        <div class="relative mb-6">
            <input
                type="search"
                value={query.value}
                onInput={(e) => query.value = (e.target as HTMLInputElement).value}
                placeholder="Search orders..."
                class="w-full px-4 py-2 pl-10 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
                aria-label="Search orders"
            />
            <svg
                class="absolute left-3 top-2.5 h-5 w-5 text-gray-400"
                fill="none" stroke="currentColor" viewBox="0 0 24 24"
            >
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
            </svg>
        </div>
    );
}
// islands/OrderForm.tsx — interactive order creation
import { useSignal } from '@preact/signals';
import { IS_BROWSER } from '$fresh/runtime.ts';

interface OrderItem {
    productId: string;
    quantity: number;
}

export default function OrderForm() {
    const items = useSignal<OrderItem[]>([{ productId: '', quantity: 1 }]);
    const isSubmitting = useSignal(false);
    const error = useSignal('');
    
    const addItem = () => {
        items.value = [...items.value, { productId: '', quantity: 1 }];
    };
    
    const removeItem = (index: number) => {
        items.value = items.value.filter((_, i) => i !== index);
    };
    
    const handleSubmit = async (e: Event) => {
        e.preventDefault();
        isSubmitting.value = true;
        error.value = '';
        
        try {
            const formData = new FormData(e.target as HTMLFormElement);
            const response = await fetch('/api/orders', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({
                    customerId: formData.get('customerId'),
                    items: items.value.filter(i => i.productId),
                }),
            });
            
            if (!response.ok) {
                const data = await response.json();
                throw new Error(data.error ?? 'Failed to create order');
            }
            
            const order = await response.json();
            window.location.href = `/orders/${order.id}`;
        } catch (e: any) {
            error.value = e.message;
        } finally {
            isSubmitting.value = false;
        }
    };
    
    if (!IS_BROWSER) {
        return <div>Loading form...</div>;
    }
    
    return (
        <form onSubmit={handleSubmit} class="space-y-4">
            {error.value && (
                <div class="bg-red-50 text-red-700 p-3 rounded">{error.value}</div>
            )}
            
            <input name="customerId" type="text" placeholder="Customer ID" required
                class="w-full border rounded px-3 py-2" />
            
            <div class="space-y-2">
                {items.value.map((item, index) => (
                    <div key={index} class="flex gap-2">
                        <input
                            type="text"
                            placeholder="Product ID"
                            value={item.productId}
                            onInput={(e) => {
                                const newItems = [...items.value];
                                newItems[index].productId = (e.target as HTMLInputElement).value;
                                items.value = newItems;
                            }}
                            class="flex-1 border rounded px-3 py-2"
                        />
                        <input type="number" min="1" max="100"
                            value={item.quantity}
                            onInput={(e) => {
                                const newItems = [...items.value];
                                newItems[index].quantity = parseInt((e.target as HTMLInputElement).value) || 1;
                                items.value = newItems;
                            }}
                            class="w-20 border rounded px-3 py-2" />
                        {items.value.length > 1 && (
                            <button type="button" onClick={() => removeItem(index)}
                                class="text-red-500 px-2">✕</button>
                        )}
                    </div>
                ))}
                <button type="button" onClick={addItem}
                    class="text-blue-600 text-sm">+ Add item</button>
            </div>
            
            <button type="submit" disabled={isSubmitting.value}
                class="w-full btn btn-primary">
                {isSubmitting.value ? 'Creating...' : 'Create Order'}
            </button>
        </form>
    );
}

Deno KV Persistence

// lib/db.ts — Deno KV database layer
const kv = await Deno.openKv();

export const db = {
    orders: {
        async list(query = ''): Promise<Order[]> {
            const entries = kv.list<Order>({ prefix: ['orders'] });
            const orders: Order[] = [];
            
            for await (const entry of entries) {
                const order = entry.value;
                if (query === '' ||
                    order.customerName.toLowerCase().includes(query.toLowerCase()) ||
                    order.id.includes(query)) {
                    orders.push(order);
                }
            }
            
            return orders.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
        },
        
        async get(id: string): Promise<Order | null> {
            const result = await kv.get<Order>(['orders', id]);
            return result.value;
        },
        
        async create(data: Omit<Order, 'id' | 'createdAt'>): Promise<Order> {
            const id = crypto.randomUUID();
            const order: Order = { ...data, id, createdAt: new Date().toISOString() };
            
            await kv.set(['orders', id], order);
            return order;
        },
        
        async cancel(id: string): Promise<void> {
            const order = await this.get(id);
            if (order) {
                await kv.set(['orders', id], { ...order, status: 'cancelled' });
            }
        },
    },
};

deno.json Configuration

{
  "imports": {
    "$fresh/": "https://deno.land/x/[email protected]/",
    "preact": "https://esm.sh/[email protected]",
    "@preact/signals": "https://esm.sh/@preact/[email protected]"
  },
  "tasks": {
    "check": "deno check **/*.ts **/*.tsx",
    "start": "deno run -A --watch=static/,routes/ dev.ts",
    "build": "deno run -A dev.ts build",
    "preview": "deno run -A main.ts"
  },
  "lint": { "rules": { "tags": ["fresh", "recommended"] } },
  "fmt": { "indentWidth": 4, "singleQuote": true }
}

For the Bun runtime alternative to Deno that also provides built-in TypeScript support, see the Bun runtime guide for Bun.serve(), bun:sqlite, and the Bun test runner. For SvelteKit as a full-stack alternative framework with similar SSR capabilities, the SvelteKit guide covers form actions and server-side rendering. The Claude Skills 360 bundle includes Deno/Fresh skill sets covering island architecture, Deno KV, and Deno Deploy configuration. Start with the free tier to try Fresh route generation.

Keep Reading

TypeScript

Claude Code for TypeScript Generics: Advanced Types, Inference, and Utility Patterns

Master TypeScript generics with Claude Code — conditional types, mapped types, template literal types, infer keyword, recursive types, builder patterns, type-safe event emitters, and discriminated unions.

9 min read Dec 1, 2026
AI

Claude Code for email.contentmanager: Python Email Content Accessors

Read and write EmailMessage body content with Python's email.contentmanager module and Claude Code — email contentmanager ContentManager for the class that maps content types to get and set handler functions allowing EmailMessage to support get_content and set_content with type-specific behaviour, email contentmanager raw_data_manager for the ContentManager instance that handles raw bytes and str payloads without any conversion, email contentmanager content_manager for the standard ContentManager instance used by email.policy.default that intelligently handles text plain text html multipart and binary content types, email contentmanager get_content_text for the handler that returns the decoded text payload of a text-star message part as a str, email contentmanager get_content_binary for the handler that returns the raw decoded bytes payload of a non-text message part, email contentmanager get_data_manager for the get-handler lookup used by EmailMessage get_content to find the right reader function for the content type, email contentmanager set_content text for the handler that creates and sets a text part correctly choosing charset and transfer encoding, email contentmanager set_content bytes for the handler that creates and sets a binary part with base64 encoding and optional filename Content-Disposition, email contentmanager EmailMessage get_content for the method that reads the message body using the registered content manager handlers, email contentmanager EmailMessage set_content for the method that sets the message body and MIME headers in one call, email contentmanager EmailMessage make_alternative make_mixed make_related for the methods that convert a simple message into a multipart container, email contentmanager EmailMessage add_attachment for the method that attaches a file or bytes to a multipart message, and email contentmanager integration with email.message and email.policy and email.mime and io for building high-level email readers attachment extractors text body accessors HTML readers and policy-aware MIME construction pipelines.

5 min read Feb 12, 2029
AI

Claude Code for email.charset: Python Email Charset Encoding

Control header and body encoding for international email with Python's email.charset module and Claude Code — email charset Charset for the class that wraps a character set name with the encoding rules for header encoding and body encoding describing how to encode text for that charset in email messages, email charset Charset header_encoding for the attribute specifying whether headers using this charset should use QP quoted-printable encoding BASE64 encoding or no encoding, email charset Charset body_encoding for the attribute specifying the Content-Transfer-Encoding to use for message bodies in this charset such as QP or BASE64, email charset Charset output_codec for the attribute giving the Python codec name used to encode the string to bytes for the wire format, email charset Charset input_codec for the attribute giving the Python codec name used to decode incoming bytes to str, email charset Charset get_output_charset for returning the output charset name, email charset Charset header_encode for encoding a header string using the charset's header_encoding method, email charset Charset body_encode for encoding body content using the charset's body_encoding, email charset Charset convert for converting a string from the input_codec to the output_codec, email charset add_charset for registering a new charset with custom encoding rules in the global charset registry, email charset add_alias for adding an alias name that maps to an existing registered charset, email charset add_codec for registering a codec name mapping for use by the charset machinery, and email charset integration with email.message and email.mime and email.policy and email.encoders for building international email senders non-ASCII header encoders Content-Transfer-Encoding selectors charset-aware message constructors and MIME encoding pipelines.

5 min read Feb 11, 2029

Put these ideas into practice

Claude Skills 360 gives you production-ready skills for everything in this article — and 2,350+ more. Start free or go all-in.

Back to Blog

Get 360 skills free