189```
190โโโ backend/
191โ โโโ database/
192โ โ โโโ migrations.ts # Schema definitions
193โ โ โโโ queries.ts # DB query functions
248 ```
249
250### Database Patterns
251- Run migrations on startup or comment out for performance
252- Change table names when modifying schemas rather than altering
315
316### SQL Operations
317- **execute-sql** / **sqlite-query**: Execute a SQL query against a SQLite database
318- **execute-sql-batch** / **sqlite-exec**: Execute multiple SQL statements against a SQLite database
319
320## Creating Val Town Projects
97```
98โโโ backend/
99โ โโโ database/
100โ โ โโโ migrations.ts
101โ โ โโโ queries.ts
229#### SQL Operations
23021. **execute-sql** / **sqlite-query**
231 - Description: Execute a SQL query against a SQLite database
232 - Arguments: `statement` (string)
233 - Returns: Query results
234
23522. **execute-sql-batch** / **sqlite-exec**
236 - Description: Execute multiple SQL statements against a SQLite database
237 - Arguments: `statements` (array of strings), Optional: `mode` (string: "read" or "write", default: "read")
238 - Returns: Results of the batch execution
9 server.tool(
10 "execute-sql",
11 "Execute a SQL query against a SQLite database",
12 {
13 statement: z.string().describe("SQL statement to execute"),
36 server.tool(
37 "execute-sql-batch",
38 "Execute multiple SQL statements against a SQLite database",
39 {
40 statements: z.array(z.string()).describe("Array of SQL statements to execute"),
67 server.tool(
68 "sqlite-query",
69 "Execute a SQL query against a SQLite database",
70 {
71 statement: z.string().describe("SQL statement to execute"),
94 server.tool(
95 "sqlite-exec",
96 "Execute multiple SQL statements against a SQLite database",
97 {
98 statements: z.array(z.string()).describe("Array of SQL statements to execute"),
172```
173โโโ backend/
174โ โโโ database/
175โ โ โโโ migrations.ts # Schema definitions
176โ โ โโโ queries.ts # DB query functions
234- Handle API calls properly with proper error catching
235
236### Database Patterns
237- Run migrations on startup or comment out for performance
238- Change table names when modifying schemas rather than altering
100 <div className="">โท Hono + React + Tailwind</div>
101 <div className="">โท React Router + React Query</div>
102 <div className="">โท Built-in database (blob storage)</div>
103 <div className="">โท Farcaster mini app manifest + webhook + embed metadata</div>
104 <div className="">โท Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
46 words refer to specific large numbers). Sean was seated at his
47 computer terminal, so he executed a search of the Internet domain name
48 registry database to see if the newly suggested name was still
49 available for registration and use. Sean is not an infallible speller,
50 and he made the mistake of searching for the name spelled as
134 3
135 </sup>. If you buy a domain at Google, maybe youโd also host your
136 website or database there, integrate with Gemini, etc.
137 </p>
138 <p>
198 other registries youโve never heard of own even more (like{" "}
199 <a href="https://www.identity.digital">Identity Digital</a>, formerly
200 named Donuts and listed in the root zone database as Binky Moon, LLC).
201 Registries pay Serious Money for some TLDs, like the $25 million Google
202 paid for <code>.app</code> when it was auctioned in 2015. Google has
4import type { Place } from "../models/place-models.ts";
5import { processCheckinEvent as _processCheckinEvent } from "../ingestion/record-processor.ts";
6import { db } from "../database/db.ts";
7import { checkinsTable } from "../database/schema.ts";
8import { eq } from "https://esm.sh/drizzle-orm";
9import type { OAuthSessionsInterface } from "jsr:@tijs/atproto-oauth-hono@^0.2.6";
429 console.log(`โ
Created checkin record: ${checkinResult.uri}`);
430
431 // IMMEDIATELY save to local database for instant feed updates
432 try {
433 const rkey = extractRkey(checkinResult.uri);
443 },
444 });
445 console.log(`โ
Saved checkin to local database: ${rkey}`);
446 } catch (localSaveError) {
447 console.error(
448 "Failed to save checkin to local database:",
449 localSaveError,
450 );
198```
199โโโ backend/
200โ โโโ database/
201โ โ โโโ migrations.ts # Schema definitions
202โ โ โโโ queries.ts # DB query functions
257 ```
258
259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
27 isEmailAlreadyInvited,
28 isEmailAlreadyParticipant
29} from "../database/queries.ts";
30
31const api = new Hono();
274 }
275
276 // Add user message to database
277 const userMessage = await addMessage(currentConversationId, 'user', message);
278
305 }
306
307 // Add assistant message to database
308 const assistantMessage = await addMessage(currentConversationId, 'assistant', assistantResponse);
309
1# Backend
2
3Hono-based API server with LastLogin authentication, SQLite database, and group chat functionality.
4
5## Structure
6
7- `index.ts` - Main HTTP handler with LastLogin wrapper
8- `database/` - Database migrations and query functions
9- `routes/` - API route handlers
10
34- `GET /api/conversations/:id/stream` - Server-Sent Events for real-time updates
35
36## Database Schema
37
38### Core Tables