63 const body = await c.req.json();
64
65 // Here you would typically save to database or send email
66 console.log("Contact form submission:", body);
67
1223 <a href="?q=fetch" className="example-link">fetch</a>
1224 <a href="?q=api" className="example-link">api</a>
1225 <a href="?q=database" className="example-link">database</a>
1226 <a href="?q=image" className="example-link">image</a>
1227 <a href="?q=function" className="example-link">function</a>
1377 <a href="?q=fetch" className="example-link">fetch</a>
1378 <a href="?q=api" className="example-link">api</a>
1379 <a href="?q=database" className="example-link">database</a>
1380 <a href="?q=image" className="example-link">image</a>
1381 <a href="?q=function" className="example-link">function</a>
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations, seedData } from "./database/migrations.ts";
3import auth from "./routes/auth.ts";
4import pets from "./routes/pets.ts";
14});
15
16// Initialize database on startup
17try {
18 await runMigrations();
19 await seedData();
20 console.log("Database initialized successfully");
21} catch (error) {
22 console.error("Database initialization failed:", error);
23}
24
11 createOrderItems,
12 getOrdersByUser
13} from "../database/queries.ts";
14import type { ApiResponse, Product, Order } from "../../shared/types.ts";
15
8 createVetAppointment,
9 getVetAppointmentsByUser
10} from "../database/queries.ts";
11import type { ServiceBookingForm, ApiResponse, GroomingAppointment, VetAppointment } from "../../shared/types.ts";
12
9 getAdoptionApplicationsByPet,
10 updateAdoptionApplicationStatus
11} from "../database/queries.ts";
12import type { PetRegistrationForm, AdoptionApplicationForm, ApiResponse, Pet, AdoptionApplication } from "../../shared/types.ts";
13
2import { sign, verify } from "https://esm.sh/hono@3.11.7/jwt";
3import { setCookie, getCookie } from "https://esm.sh/hono@3.11.7/cookie";
4import { createUser, getUserByEmail, getUserPasswordHash, getUserById } from "../database/queries.ts";
5import type { UserRegistrationForm, LoginForm, ApiResponse, User } from "../../shared/types.ts";
6
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for Pet Adoption & Services Platform
4// Change table names when modifying schemas (add _2, _3, etc.)
5
6export async function runMigrations() {
7 console.log("Running database migrations...");
8
9 // Users table
191 `);
192
193 console.log("Database migrations completed successfully!");
194}
195
45```
46โโโ backend/
47โ โโโ database/
48โ โ โโโ migrations.ts # Database schema
49โ โ โโโ queries.ts # Database operations
50โ โโโ routes/
51โ โ โโโ auth.ts # Authentication routes
77- **Backend**: Hono (TypeScript API framework)
78- **Frontend**: React 18.2.0 with TypeScript
79- **Database**: SQLite
80- **Styling**: TailwindCSS
81- **Authentication**: JWT-based auth
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