119 organization: "XYZ University", // Replace with actual university
120 period: "2022 - 2026 (Expected)",
121 description: "Currently in 3rd year, focusing on AI/ML specialization. Relevant coursework: Data Structures, Algorithms, Machine Learning, Deep Learning, Computer Vision, Database Systems.",
122 type: "education"
123 },
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.
124
125 if (error) {
126 throw new Error(`Database error: ${error.message}`);
127 }
128
1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
5
6await createTables();
35```
36โโโ backend/
37โ โโโ database/
38โ โ โโโ migrations.ts # Database schema (user-scoped + legacy)
39โ โ โโโ queries.ts # Database operations with user scoping
40โ โ โโโ user-queries.ts # User management operations
41โ โโโ mcp/
3import { Hono } from "https://esm.sh/hono@3.11.7";
4import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
5import { runMigrations, createDefaultAdmin } from './database/migrations.ts';
6import { authMiddleware, optionalAuthMiddleware, adminMiddleware, customerMiddleware } from './middleware/auth.ts';
7
20});
21
22// Initialize database on startup
23let dbInitialized = false;
24async function initializeDatabase() {
25 if (!dbInitialized) {
26 console.log('Initializing database...');
27 try {
28 await runMigrations();
29 await createDefaultAdmin();
30 dbInitialized = true;
31 console.log('Database initialized successfully');
32 } catch (error) {
33 console.error('Database initialization failed:', error);
34 throw error;
35 }
40app.get('/health', async (c) => {
41 try {
42 await initializeDatabase();
43 return c.json({
44 status: 'healthy',
45 timestamp: new Date().toISOString(),
46 database: 'connected'
47 });
48 } catch (error) {
81app.get("/", async c => {
82 try {
83 await initializeDatabase();
84
85 let html = await readFile("/frontend/index.html", import.meta.url);
138 }
139
140 await initializeDatabase();
141
142 let html = await readFile("/frontend/index.html", import.meta.url);
2
3import { Hono } from "https://esm.sh/hono@3.11.7";
4import { ProductQueries, CategoryQueries } from '../database/queries.ts';
5import { validateBody, validateQuery, schemas, getValidatedBody, getValidatedQuery } from '../middleware/validation.ts';
6import type { User, Product, ProductSearchParams } from '../../shared/types.ts';
2
3import { Hono } from "https://esm.sh/hono@3.11.7";
4import { UserQueries } from '../database/queries.ts';
5import { JWTUtils, PasswordUtils } from '../middleware/auth.ts';
6import { validateBody, schemas, getValidatedBody } from '../middleware/validation.ts';
2
3import { Context, Next } from "https://esm.sh/hono@3.11.7";
4import { UserQueries } from '../database/queries.ts';
5import type { User } from '../../shared/types.ts';
6
1// Database query functions for IoT Solutions platform
2
3import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";