Full-stack message board built for Val Town.
├── backend/ # Hono server running on Val Town
│ ├── database/ # Drizzle schema, migrations, and queries
│ └── index.ts # Main Hono application
├── frontend/ # React app running in browser
│ ├── components/ # React components
│ ├── lib/ # Utilities and hooks
│ └── router.tsx # TanStack Router configuration
└── shared/ # Code shared between frontend and backend
GET /
- Serves the React application with initial dataGET /api/messages
- Fetch all messages (JSON)POST /api/messages
- Create a new messageGET /public/**
- Static assets (CSS, JS, etc.)/*
- All other routes handled by TanStack Routerconst homeRoute = new Route({
getParentRoute: () => rootRoute,
path: "/",
component: () => <App {...window.__INITIAL_DATA__} />
});
export function usePostMessage() {
return useMutation({
mutationFn: (content: string) => postMessage(content),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["messages"] });
},
});
}
export const messages = sqliteTable("messages", {
id: integer("id").primaryKey({ autoIncrement: true }),
content: text("content").notNull(),
timestamp: text("timestamp").notNull().default(new Date().toISOString()),
});