FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
valeriewwong
valeriewwongdesignreview
Public
Like
designreview
Home
Code
9
.claude
1
backend
1
frontend
2
.vtignore
CLAUDE.md
TODO.md
debug_braces.js
debug_braces_detailed.js
deno.json
Branches
1
Pull requests
Remixes
1
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
CLAUDE.md
Code
/
CLAUDE.md
Search
7/23/2025
Viewing readonly version of main branch: v433
View latest version
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is a Val Town project - a full-stack web application combining React frontend with Hono backend, designed for Val Town's Deno-based serverless platform.

Architecture

Core Structure

├── backend/
│   └── server.ts         # Hono HTTP server with API routes
├── frontend/
│   ├── index.html        # HTML entry point
│   └── app.tsx           # React application component
├── deno.json            # Deno configuration
└── .cursorrules         # Val Town development guidelines

Technology Stack

  • Runtime: Deno (not Node.js)
  • Backend: Hono web framework serving HTTP requests
  • Frontend: React 18.2.0 from ESM.sh CDN
  • Modules: ESM imports from esm.sh and esm.town
  • Platform: Val Town serverless environment

Key Patterns

File Serving

Uses Val Town's serveFile utility for proper content-type handling:

Create val
import { serveFile } from "https://esm.town/v/std/utils@85-main/index.ts"; app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));

React Configuration

All React files must include JSX pragma and use pinned versions:

Create val
/** @jsxImportSource https://esm.sh/react@18.2.0 */ import React from "https://esm.sh/react@18";

Error Handling

Include error unwrapping for proper debugging:

Create val
app.onError((err, c) => { throw err; });

Entry Point

HTTP vals must export the fetch handler:

Create val
export default app.fetch;

Development Commands

No traditional build commands - code runs directly on Val Town's platform. Files are served and executed as-is.

Code Verification

  • Lint code: deno lint - Check for code quality issues
  • Type check: deno check backend/server.ts - Verify TypeScript types

Platform Constraints

  • No binary files - text-only file system
  • ESM modules only - no Node.js compatibility required
  • CDN dependencies - external module loading from esm.sh
  • Serverless limitations - stateless request handling only

Val Town Standard Libraries

Key utilities available:

  • Blob storage: import { blob } from "https://esm.town/v/std/blob"
  • SQLite: import { sqlite } from "https://esm.town/v/stevekrouse/sqlite"
  • OpenAI: import { OpenAI } from "https://esm.town/v/std/openai"
  • Email: import { email } from "https://esm.town/v/std/email"

Important Rules

  1. Always pin React to 18.2.0 across all dependencies
  2. Use npm: prefix for npm imports in server-side code only
  3. Use esm.sh URLs for client-side imports
  4. Include JSX pragma in all TSX files
  5. Change SQLite table names instead of altering schemas
  6. Use environment variables for secrets via Deno.env.get()
  7. Avoid Node.js APIs - stick to Deno and web standards

Current Application

Simple React counter app demonstrating:

  • Hono server with static file serving
  • React state management
  • API endpoints (/api/health)
  • Proper file separation between frontend/backend
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesCLIAI agentsCode intelligenceSlack integrationsGTMPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.