• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
ianmenethil

ianmenethil

ZenServer

Unlisted
Like
ZenServer
Home
Code
17
.cursor
docs
7
src
11
tasks
tests
.env.example
.gitignore
.vtignore
ISSUES.md
README.md
VAL_TOWN_CHANGES.md
VAL_TOWN_DEPLOYMENT.md
deno.json
main-universal.ts
main-valtown.ts
H
main.ts
openapi.json
Branches
1
Pull requests
Remixes
History
Environment variables
22
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
/
VAL_TOWN_CHANGES.md
Code
/
VAL_TOWN_CHANGES.md
Search
7/6/2025
Viewing readonly version of main branch: v152
View latest version
VAL_TOWN_CHANGES.md

Val Town Compatibility Summary

Changes Made for Val Town Deployment

1. Created Val Town Compatible Modules

env-loader-valtown.ts

  • Skips all filesystem operations
  • Automatically sets APP_ENV=prod when on Val Town
  • Returns immediately without trying to read .env.dev

logger-valtown.ts

  • Console-only logging (no file handlers)
  • Removes all Deno.mkdir and file write operations
  • Maintains same API for compatibility
  • Preserves colored console output and emojis

openApiLoader-valtown.ts

  • Uses embedded OpenAPI spec instead of reading from file
  • Extends original loader class to override loadSpec method
  • Maintains all other functionality

embeddedOpenApiSpec.ts

  • Contains the entire OpenAPI specification as a JavaScript object
  • Eliminates need for openapi.json file

apiGateway-valtown.ts

  • Uses Val Town compatible imports
  • Otherwise identical to original

2. Created Helper Files

moduleSelector.ts

  • Automatically detects Val Town environment
  • Loads appropriate modules based on environment
  • Provides unified interface for both environments

main-universal.ts

  • Single entry point that works everywhere
  • Uses module selector for environment detection
  • Exports appropriately for Val Town or starts server locally

3. Usage Instructions

For Val Town Deployment:

// Option 1: Use the universal main import "./main-universal.ts"; // Option 2: Use Val Town specific files import "./main-valtown.ts";

For Local Development:

# Continue using original main.ts deno run --allow-all main.ts # Or use universal main deno run --allow-all main-universal.ts

4. Environment Variables

Set these in Val Town's environment settings:

  • PAYMENT_USERNAME
  • PAYMENT_PASSWORD
  • TURNSTILE_SECRET_KEY
  • ALLOWED_ORIGINS (comma-separated list)
  • ADMIN_API_KEY
  • SESSION_SECRET
  • WEBHOOK_SECRET
  • VALTOWN_TOKEN

5. Key Differences

FeatureLocal DevelopmentVal Town
Config FilesReads .env.devUses Val Town env vars
LoggingFile + ConsoleConsole only
OpenAPI SpecReads openapi.jsonEmbedded in code
File AccessFull filesystemNo filesystem access

6. Testing

After deployment, test these endpoints:

  • GET / - Basic health check
  • GET /health - Health status
  • GET /api/v1/tours - API functionality
  • GET /openapi.json - OpenAPI spec serving

7. No Code Changes Required

All handlers, middleware, and services work without modification. The compatibility layer handles all environment differences transparently.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.