6 searchPackages,
7 getFeaturedPackages
8} from "../database/queries.ts";
9import { SearchParams } from "../../shared/types.ts";
10
1import { Hono } from "https://esm.sh/hono@3.11.12";
2import { jwt } from "https://esm.sh/hono@3.11.12/jwt";
3import { createUser, getUserByEmail } from "../database/queries.ts";
4import { LoginRequest, RegisterRequest, UserProfile } from "../../shared/types.ts";
5import { isValidEmail, isStrongPassword, parsePreferences, stringifyPreferences } from "../../shared/utils.ts";
3import { jwt } from "https://esm.sh/hono@3.11.12/jwt";
4import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
5import { runMigrations } from "./database/migrations.ts";
6import { getFeaturedPackages } from "./database/queries.ts";
7
8// Import route handlers
13import { paymentRoutes } from "./routes/payments.ts";
14
15// Initialize database
16await runMigrations();
17
15```
16โโโ backend/
17โ โโโ database/
18โ โ โโโ migrations.ts # Schema definitions
19โ โ โโโ queries.ts # DB query functions
42## Technology Stack
43
44- **Backend**: Hono (API framework), SQLite (database)
45- **Frontend**: React, TailwindCSS
46- **Authentication**: JWT-based authentication
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4
5// Import database modules
6import { initDatabase } from "./database/schema.ts";
7import { seedDatabase } from "./database/seed.ts";
8
9// Import auth modules
33app.use("*", cors());
34
35// Initialize database on startup
36initDatabase()
37 .then(() => seedDatabase())
38 .catch(console.error);
39
1# Toy Store Database
2
3This directory contains the database setup, migrations, and queries for the Toy Store website.
4
5## Files
6
7- `migrations.ts` - Database schema setup and seed data
8- `queries.ts` - Functions for querying the database
9
10## Database Schema
11
12### Categories Table
6
7- `index.ts` - Main entry point and API routes using Hono framework
8- `database/` - Database setup, migrations, and queries
9
10## API Endpoints
2import { cors } from "https://esm.sh/hono@3.11.7/middleware";
3import { readFile, serveFile, parseProject } from "https://esm.town/v/std/utils@85-main/index.ts";
4import { initializeDatabase } from "./database/migrations.ts";
5import {
6 getCategories,
10 getCategoryBySlug,
11 searchProducts
12} from "./database/queries.ts";
13
14// Initialize the app
23app.use("*", cors());
24
25// Initialize database on startup
26await initializeDatabase();
27
28// Get project info for view source links
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { DashboardStats, PropertyStatus, InquiryStatus } from "../../shared/types.ts";
3import { PROPERTIES_TABLE, INQUIRIES_TABLE } from "../database/schema.ts";
4import { getFeaturedProperties } from "./propertyController.ts";
5import { getInquiries } from "./inquiryController.ts";
9 User
10} from "../../shared/types.ts";
11import { PROPERTIES_TABLE, USERS_TABLE } from "../database/schema.ts";
12
13// Helper function to build property object from database row
14export function buildPropertyFromRow(row: any): Property {
15 return {