stainlessTodoSweeper
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.
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!
}