Backend - Team Travel Chat API

Hono-based API server providing real-time chat functionality for travel planning.

Structure

  • index.ts - Main Hono application with HTTP endpoints
  • database/migrations.ts - SQLite table setup
  • database/queries.ts - Database query functions

Endpoints

  • GET / - Serves the chat interface with initial message data
  • GET /api/messages - Returns recent messages (JSON)
  • POST /api/messages - Creates new message (JSON)
  • GET /api/messages/stream - Server-sent events for real-time updates
  • GET /frontend/* - Serves frontend static files
  • GET /shared/* - Serves shared utility files

Database Schema

CREATE TABLE travel_chat_messages_1 ( id INTEGER PRIMARY KEY AUTOINCREMENT, author TEXT NOT NULL, content TEXT NOT NULL, timestamp TEXT NOT NULL, created_at INTEGER NOT NULL );

Real-time Updates

Uses Server-Sent Events (SSE) to push new messages to connected clients every 2 seconds.