Unlisted
Like
scaffold
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.
Viewing readonly version of main branch: v24View latest version
This directory contains code shared between frontend (browser) and backend (Deno).
-
types.ts - TypeScript interfaces and types
- Controller response format
- Notion data structures
- API request/response types
-
utils.ts - Utility functions
- Must work in both browser AND Deno
- ❌ NEVER use Deno APIs (won't work in browser)
- ✅ Only use standard JavaScript/TypeScript
- Define interfaces for data shared between layers
- Use clear, descriptive names (PascalCase)
- Document complex types with comments
- Test that functions work in both environments
- Avoid platform-specific APIs (Deno, Node, browser-only)
- Use pure functions when possible
// ✅ Good - works everywhere
export function formatDate(date: string): string {
return new Date(date).toLocaleDateString();
}
// ❌ Bad - Deno-specific
export function readConfig() {
return Deno.env.get('CONFIG'); // Won't work in browser!
}