1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { requireAuth } from "./auth.ts";
3import { getUserById, updateUser } from "../database/queries.ts";
4import { get3DIllustrationUrl } from "../../shared/utils.ts";
5import type { UpdateProfileRequest, ApiResponse, User } from "../../shared/types.ts";
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { requireAuth } from "./auth.ts";
3import { createPost, getPosts, getPostById, toggleLike } from "../database/queries.ts";
4import { generateId } from "../../shared/utils.ts";
5import type { CreatePostRequest, ApiResponse, Post } from "../../shared/types.ts";
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { setCookie, getCookie, deleteCookie } from "https://esm.sh/hono@3.11.7/cookie";
3import { createUser, getUserByEmail, getUserPasswordHash, getUserById } from "../database/queries.ts";
4import { generateId, validateEmail, validateUsername, getRandomAvatar } from "../../shared/utils.ts";
5import type { LoginRequest, RegisterRequest, ApiResponse, User } from "../../shared/types.ts";
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for BubbleSpace
4// Note: Change table names when modifying schemas (e.g., add _v2, _v3)
5
15
16export async function runMigrations() {
17 console.log('Running database migrations...');
18
19 // Users table
122 await sqlite.execute(`CREATE INDEX IF NOT EXISTS idx_likes_post_id ON ${TABLES.LIKES}(post_id)`);
123
124 console.log('Database migrations completed successfully');
125}
18```
19โโโ backend/
20โ โโโ database/
21โ โ โโโ migrations.ts # Database schema
22โ โ โโโ queries.ts # Database operations
23โ โโโ routes/
24โ โ โโโ auth.ts # Authentication routes
44## Tech Stack
45
46- **Backend**: Hono.js with SQLite database
47- **Frontend**: React 18.2.0 with TypeScript
48- **Styling**: TailwindCSS with custom animations
25const twitterAPI = new TwitterAPI();
26
27// Database setup
28const TABLE_NAME = 'social_bot_posts_v1';
29
30// Initialize database
31async function initDatabase() {
32 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
33 id TEXT PRIMARY KEY,
46
47// Initialize on startup
48await initDatabase();
49
50// Dashboard - serve the main interface
84 const generated = await contentGenerator.generateContent(request);
85
86 // Save to database
87 const postId = `post_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
88
133 );
134
135 // Save results to database
136 for (const result of results) {
137 const postId = `post_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
205 );
206
207 // Save to database
208 for (const result of results) {
209 const postId = `post_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
28 this.openai = new OpenAI();
29 this.twitterAPI = new TwitterAPI();
30 this.initDatabase();
31 }
32
33 private async initDatabase() {
34 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${INTERACTIONS_TABLE} (
35 id TEXT PRIMARY KEY,
7export class ContentScheduler {
8 constructor() {
9 this.initDatabase();
10 }
11
12 private async initDatabase() {
13 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${SCHEDULED_POSTS_TABLE} (
14 id TEXT PRIMARY KEY,
54 );
55
56 // Save results to database
57 for (const result of results) {
58 const postId = `auto_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
10
11[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.