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

nichoth

template-datastar-valtown

Public
Like
template-datastar-valtown
Home
Code
11
.claude
1
.vscode
1
src
3
.gitignore
.vtignore
AGENTS.md
README.md
deno.json
package.json
H
server.http.tsx
tsconfig.json
Environment variables
Branches
1
Pull requests
Remixes
History
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
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v27
View latest version
README.md

template datastar valtown

A template for datastar apps with Hono and Val Town.

There is no client-side JS here, except for the data-star library. This uses Hono to keep any application state on the server (it uses in-memory state only), and clicks result in a request to the server, which sends back the updated data.

This does depend on the val command line tool.

Val Town treats files with .http in the name as web endpoints.

Contents

  • Deploy
  • Develop
  • Components
    • page.tsx
  • The Datastar SSR pattern

Deploy

Use the Val Town CLI to push the project:

vt push

Develop

Use vt watch to auto-sync changes to Val Town as you edit locally:

vt watch

Components

The HTTP entry point is server.http.tsx, which defines a Hono app with all routes. It renders the Page component for the homepage and returns SSE responses for API endpoints.

page.tsx

The page.tsx is a layout skeleton that accepts props.

Create val
export const Page:FC<PropsWithChildren<PageProps>> = ({ title, signals = {}, children })

Any site pages should extend this template, and pass in content and signals. An example is ./src/home-page.tsx.


The Datastar SSR pattern

  • Server renders the full HTML with components
  • data-signals initializes the reactive state
  • Datastar library (loaded via CDN) handles client-side reactivity
  • API endpoints return SSE responses that update signals
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.