7 atualizarCasa,
8 removerCasa
9} from "../database/queries.ts";
10import type { FiltrosCasa } from "../../shared/types.ts";
11
13
14- `/backend`: API e lógica do servidor
15 - `/database`: Configuração e consultas do banco de dados
16 - `/routes`: Rotas da API
17- `/frontend`: Interface do usuário
19});
20
21// Initialize database
22const TABLE_NAME = 'todos';
23async function initDb() {
30}
31
32// Initialize database on startup
33initDb();
34
6
7- `index.ts` - Main entry point with Hono API routes
8- `database/` - Database setup and queries
9 - `migrations.ts` - Database schema definitions
10 - `queries.ts` - Database query functions
11
12## API Endpoints
22- `POST /api/messages` - Create a new chat message
23
24## Database
25
26The application uses SQLite for data storage with two main tables:
2import { cors } from "https://esm.sh/hono@3.12.6/cors";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import { initDatabase } from "./database/migrations.ts";
5import {
6 getAllJobs,
8 getRecentMessages,
9 createMessage
10} from "./database/queries.ts";
11
12// Initialize the app
21app.use("*", cors());
22
23// Initialize database on startup
24await initDatabase();
25
26// API Routes
6
7/**
8 * Initialize database tables
9 */
10export async function initDatabase() {
11 // Create jobs table
12 await sqlite.execute(`
15## Project Structure
16
17- `/backend` - Hono API server with SQLite database
18- `/frontend` - HTML/JS frontend with Tailwind CSS
19- `/shared` - Shared types and utilities
17
18- Frontend: HTML, CSS, JavaScript
19- Backend/Database: Supabase (PostgreSQL)
20- Deployment: Vercel
21- Version Control: Git
29- **Theme Options**: Light, dark, and system theme support
30
31### Database Structure
32
33- **Conversations**: Store chat history
42 - OpenAI integration for chat completions
43 - API endpoints for authentication, chat, and user data
44 - Supabase integration for database and authentication
45
46- **Frontend**:
66- **Frontend**: React with TypeScript
67- **Backend**: Hono on Deno
68- **Database**: Supabase
69- **Authentication**: Supabase Auth
70- **AI**: OpenAI API
218 setMessages(updatedMessages);
219
220 // If user is logged in, update in database
221 if (user && conversation) {
222 try {