1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createAppointment, isTimeSlotAvailable, getAppointmentsByDate } from "../database/queries.ts";
3import type { ServiceType } from "../../shared/types.ts";
4
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getRecentChatMessages, addChatMessage } from "../database/queries.ts";
3
4const chat = new Hono();
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllBlogPosts, getBlogPost } from "../database/queries.ts";
3
4const blog = new Hono();
14```
15โโโ backend/
16โ โโโ database/
17โ โ โโโ migrations.ts # Database schema setup
18โ โ โโโ queries.ts # Database query functions
19โ โโโ routes/
20โ โ โโโ blog.ts # Blog API endpoints
38
39- **Backend**: Hono (TypeScript API framework)
40- **Database**: SQLite
41- **Frontend**: React with TypeScript
42- **Styling**: TailwindCSS
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 { runMigrations } from "./database/migrations.ts";
4import webhook from "./routes/webhook.ts";
5import api from "./routes/api.ts";
12});
13
14// Initialize database on startup
15await runMigrations();
16
5 getAllChats,
6 getMessageById
7} from "../database/queries.ts";
8import type { DeletedMessageResponse } from "../../shared/types.ts";
9
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { WhatsAppWebhookPayload } from "../../shared/types.ts";
3import { saveMessage, markMessageAsDeleted } from "../database/queries.ts";
4
5const webhook = new Hono();
102 }
103
104 // Save message to database
105 await saveMessage({
106 id: message.id,
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for WhatsApp message tracking
4export const MESSAGES_TABLE = 'whatsapp_messages_v1';
5export const CHATS_TABLE = 'whatsapp_chats_v1';
6
7export async function runMigrations() {
8 console.log('Running database migrations...');
9
10 // Create messages table
50 `);
51
52 console.log('Database migrations completed successfully');
53}
32```
33โโโ backend/
34โ โโโ database/
35โ โ โโโ migrations.ts # Database schema
36โ โ โโโ queries.ts # Database operations
37โ โโโ routes/
38โ โ โโโ webhook.ts # WhatsApp webhook handler
53
541. WhatsApp sends webhook events when messages are received or deleted
552. The app stores all incoming messages in the database
563. When a deletion event is received, the message is marked as deleted
574. Users can view deleted messages through the web interface
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 { runMigrations } from "./database/migrations.ts";
4import { getAllJobs, getChatMessages } from "./database/queries.ts";
5import jobsRouter from "./routes/jobs.ts";
6import chatRouter from "./routes/chat.ts";
13});
14
15// Initialize database on startup
16await runMigrations();
17