6
7- `index.ts` - Main entry point with HTTP API routes
8- `database/` - Database setup and query functions
9 - `migrations.ts` - Database schema definitions
10 - `queries.ts` - Functions for interacting with the database
11
12## API Endpoints
2import { cors } from "https://esm.sh/hono@3.11.7/middleware";
3import { readFile, serveFile } from "https://esm.town/v/std/utils/index.ts";
4import { runMigrations } from "./database/migrations.ts";
5import {
6 getUserById, createUser,
7 getTestsByUserId, getTestById,
8 createTest, updateTest, deleteTest
9} from "./database/queries.ts";
10import { ApiResponse, CreateTestRequest, UpdateTestRequest } from "../shared/types.ts";
11
6
7/**
8 * Run database migrations to set up the schema
9 */
10export async function runMigrations() {
12## Project Structure
13
14- `/backend` - Server-side code with API endpoints and database operations
15- `/frontend` - Client-side code with UI components and styling
16- `/shared` - Shared types and utilities used by both frontend and backend
18## Technologies
19
20- Backend: Hono.js for API, SQLite for database
21- Frontend: React with Tailwind CSS for styling
22- Shared: TypeScript for type safety
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllJobs, createJob } from "../database/queries.ts";
3import type { JobPosting } from "../../shared/types.ts";
4
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getChatMessages, addChatMessage } from "../database/queries.ts";
3import type { ChatMessage } from "../../shared/types.ts";
4
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { cors } from "https://esm.sh/hono@3.11.7/middleware";
3import { runMigrations } from "./database/migrations.ts";
4import jobRoutes from "./routes/jobs.ts";
5import chatRoutes from "./routes/chat.ts";
19app.use("*", cors());
20
21// Run database migrations on startup
22app.use("*", async (c, next) => {
23 try {
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { getAllJobs, getChatMessages } from "../database/queries.ts";
4
5const static_routes = new Hono();
30 `);
31
32 console.log("Database migrations completed");
33}
16
17- Backend: Hono (TypeScript)
18- Database: SQLite
19- Frontend: HTML, TypeScript, Tailwind CSS
20- Authentication: Simple username-based system
24```
25โโโ backend/
26โ โโโ database/
27โ โ โโโ migrations.ts # Schema definitions
28โ โ โโโ queries.ts # DB query functions