• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
stevekrouse

stevekrouse

zod_demo_http

Public
Like
zod_demo_http
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
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
/
Code
/
Search
main.tsx
https://stevekrouse--edbb415c25f111f0ad23569c3dd06744.web.val.run
README.md

This val shows how to break up your HTTP val into three vals:

  • @stevekrouse/zod_demo_http (this val)
  • @stevekrouse/zod_demo_frontend (client-side react component)
  • @stevekrouse/zod_demo_shared (code that is imported in both vals, but only run on the backend)

I have these vals in a folder. Unfortunately, folders are not publicly shareable, which is why I listed all the vals above. The Val Town full-screen editor makes it a lot easier to work with multiple vals at once.

The trickiest and most interesting part of this particular demo is how we import just the zod type in the frontend which avoids the error if we were to import any real value from that shared file. In this sense, it's not a truly safe shared file.

Open questions

  1. I don't know why zod types aren't working when imported via esm.sh
  2. I don't know how we would get zod validation working on the frontend without reimporting zod from esm.sh (which would then lose us types or require us to duplicate the zod code)

Migrated from folder: Archive/zod_demo/zod_demo_http

HTTP
  • main.tsx
    stevekrouse--ed…44.web.val.run
Code
README.md
H
main.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.