
This is a starter template for a full-stack app in a Val Town Project. The app itself is a simple persistent message board.
This app is broken up into three folders, corresponding to where the code in those folders run:
- backend - runs on Val Town serverless infrastructure in Deno
- frontend - runs in the user's browser
- shared - runs in both the frontend and backend
The entrypoint of this app is backend/index.ts
, which is the Hono HTTP server, which serves the HTML, CSS, and JS, which run client-side.
In this template, the backend uses Hono as the a server application framework. You can think of Hono as a replacement for ExpressJS that works in serverless environments like Val Town or Cloudflare Workers. If you come from Python or Ruby, Hono is also a lot like Flask or Sinatra, respectively.
This app uses Val Town SQLite to manage data. Every Val Town account comes with a free SQLite database, hosted on Turso. In backend/database/migrations.ts
, this app creates a new SQLite table reactHonoStarter_messages
to store messages. This "migration" runs once on every app startup because it's imported in index.ts
. You can comment this line out for a slight performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.