1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { authMiddleware } from "./auth.ts";
3import { getUserById, updateUser, getFreelancers } from "../database/queries.ts";
4import type { ApiResponse, User } from "../../shared/types.ts";
5
15```
16โโโ backend/
17โ โโโ database/
18โ โ โโโ migrations.ts # Database schema setup
19โ โ โโโ queries.ts # Database query functions
20โ โโโ routes/
21โ โ โโโ auth.ts # Authentication routes
44
45- **Backend**: Hono (TypeScript API framework)
46- **Database**: SQLite with Val Town's sqlite service
47- **Frontend**: React 18.2.0 with TypeScript
48- **Styling**: TailwindCSS
53
541. The app runs on Val Town's platform
552. Database tables are automatically created on first run
563. Visit the main URL to access the platform
574. Register as a freelancer or client to get started
2
3export async function runMigrations() {
4 console.log("Running database migrations...");
5
6 // Users table
78 await sqlite.execute(`CREATE INDEX IF NOT EXISTS idx_chat_created_at ON chat_messages(created_at DESC)`);
79
80 console.log("Database migrations completed successfully");
81}
8 createJobApplication,
9 getJobApplications
10} from "../database/queries.ts";
11import type { ApiResponse, Job, JobApplication } from "../../shared/types.ts";
12
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations } from "./database/migrations.ts";
3import authRoutes from "./routes/auth.ts";
4import userRoutes from "./routes/users.ts";
14});
15
16// Initialize database on startup
17try {
18 await runMigrations();
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { authMiddleware } from "./auth.ts";
3import { getChatMessages, createChatMessage } from "../database/queries.ts";
4import { getUserById } from "../database/queries.ts";
5import type { ApiResponse, ChatMessage } from "../../shared/types.ts";
6
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { sign, verify } from "https://esm.sh/hono@3.11.7/jwt";
3import { createUser, getUserByEmail } from "../database/queries.ts";
4import type { AuthResponse } from "../../shared/types.ts";
5
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."),
174```
175โโโ backend/
176โ โโโ database/
177โ โ โโโ migrations.ts # Schema definitions
178โ โ โโโ queries.ts # DB query functions
234 ```
235
236### Database Patterns
237- Run migrations on startup or comment out for performance
238- Change table names when modifying schemas rather than altering