1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { cors } from "https://esm.sh/@hono/cors@0.0.6";
3import { getAllJobPostings, getJobPostingById, createJobPosting } from "../database/queries.ts";
4import type { JobPostingFormData } from "../../shared/types.ts";
5
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { cors } from "https://esm.sh/@hono/cors@0.0.6";
3import { runMigrations } from "./database/migrations.ts";
4import jobRoutes from "./routes/jobs.ts";
5import chatRoutes from "./routes/chat.ts";
18});
19
20// Run database migrations on startup
21app.use("*", async (c, next) => {
22 try {
15
16- Backend: Hono (TypeScript)
17- Database: SQLite
18- Frontend: React with Tailwind CSS
19- Real-time: Server-sent events for chat updates
21## Project Structure
22
23- `/backend`: API routes and database logic
24- `/frontend`: React components and UI
25- `/shared`: Shared types and utilities
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations } from "./database/migrations.ts";
3import authRoutes from "./routes/auth.ts";
4import projectRoutes from "./routes/projects.ts";
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
10
11[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.
21// API endpoint to get all themes
22app.get('/api/themes', async c => {
23 // In a real app, this would come from a database
24 const themes = [
25 {
128 const id = c.req.param('id');
129
130 // In a real app, this would come from a database
131 const themes = await app.fetch('/api/themes').then(res => res.json());
132 const theme = themes.find((t: any) => t.id === id);
139});
140
141// API endpoint to submit an order (this would typically store the order in a database)
142app.post('/api/orders', async c => {
143 try {
149 }
150
151 // In a real app, this would store the order in a database
152 // and potentially trigger a WhatsApp notification to the business owner
153
1# Discord Authentication with better-auth and SQLite
2
3This project implements Discord OAuth authentication using the `better-auth` library and Val Town's built-in SQLite database.
4
5## Project Structure
6
7- `/backend/index.ts` - Main entry point for the HTTP API
8- `/backend/database/schema.ts` - Database schema and migrations
9- `/backend/auth/discord.ts` - Discord authentication implementation
10- `/frontend/index.html` - Simple frontend for testing authentication
9- [ ] make it one click to branch off like old jp townie demos
10- [ ] opentownie as a pr bot
11- [ ] give it the ability to see its own client-side and server-side logs by building a middleware that shoves them into a SQL light database date and then give it a tool to access them
12- [ ] do a browser use or screenshot thing to give it access to its own visual output
13- [ ] Have it default to creating a new branch off main
7export const thinkTool = tool({
8 description:
9 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
10 parameters: z.object({
11 thought: z.string().describe("A thought to think about."),
192```
193โโโ backend/
194โ โโโ database/
195โ โ โโโ migrations.ts # Schema definitions
196โ โ โโโ queries.ts # DB query functions
252 ```
253
254### Database Patterns
255- Run migrations on startup or comment out for performance
256- Change table names when modifying schemas rather than altering