Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Burl%7D?q=database&page=340&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=database

Returns an array of strings in format "username" or "username/projectName"

Found 4128 results for "database"(1210ms)

EchoPromptermain.tsx8 matches

@Learnโ€ขUpdated 1 month ago
940 const openai = new OpenAI();
941
942 // Use the val's URL as a unique key for database tables
943 const KEY = "EchoPrompter";
944
945 // Initialize database tables
946 await sqlite.execute(`
947 CREATE TABLE IF NOT EXISTS ${KEY}_agents (
976 });
977 } catch (error) {
978 console.error("Database error:", error);
979 return new Response(
980 JSON.stringify({ error: "Failed to fetch recent agents" }),
1172 }
1173
1174 // Insert into database with commands
1175 const result = await sqlite.execute(
1176 `INSERT INTO ${KEY}_agents (name, description, prompt, commands) VALUES (?, ?, ?, ?)`,
1212 const { agentId, message, history } = await request.json();
1213
1214 // Get agent from database
1215 const agentResult = await sqlite.execute(
1216 `SELECT * FROM ${KEY}_agents WHERE id = ?`,
1262 const response = completion.choices[0].message.content;
1263
1264 // Log conversation in database
1265 await sqlite.execute(
1266 `INSERT INTO ${KEY}_conversations (agent_id, user_message, assistant_response) VALUES (?, ?, ?)`,
1291 const { agentId, command, inputs, history } = await request.json();
1292
1293 // Get agent from database
1294 const agentResult = await sqlite.execute(
1295 `SELECT * FROM ${KEY}_agents WHERE id = ?`,
1475}
1476
1477async function initDatabase(db) {
1478 // Create agents table if not exists
1479 await db.execute(`

Brainblastmain.tsx1 match

@orjpapโ€ขUpdated 1 month ago
38 `);
39
40 // Insert the game into the database
41 await sqlite.execute({
42 sql: `INSERT INTO games (gameId, player1) VALUES (:gameId, :player1)`,

cerebras_coderindex2 matches

@Learnโ€ขUpdated 1 month ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

OpenTowniethink.ts1 match

@stevekrouseโ€ขUpdated 1 month ago
7export const thinkTool = tool({
8 description:
9 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
10 parameters: z.object({
11 thought: z.string().describe("A thought to think about."),

groqAudioWordLevelmain.tsx5 matches

@yawnxyzโ€ขUpdated 1 month ago
265// Alpine data and methods
266const getAlpineModule = () => `
267 // Initialize Dexie database
268 let dbInstance = null;
269
300
301 async init() {
302 // Initialize database
303 this.db = await initializeDB();
304
384 timestamp: new Date()
385 });
386 console.log('Local audio file saved to database');
387 } catch (blobError) {
388 console.error('Error saving audio blob:', blobError);
401 timestamp: new Date()
402 });
403 console.log('Remote audio file fetched and saved to database');
404 } else {
405 console.warn('Could not fetch audio from URL, only saving transcript data');
790 this.processTranscript(result);
791
792 // Auto-save the transcript to database
793 await this.autoSaveTranscript();
794 }

OpenTownieTODOs.md1 match

@arfanโ€ขUpdated 1 month ago
6- [ ] Rebuild as React Router?
7- [ ] opentownie as a pr bot
8- [ ] give it the ability to see its own client-side and server-side logs by building a middleware that shoves them into a SQL light database date and then give it a tool to access them or use our trpc API in that tool
9- [ ] do a browser use or screenshot thing to give it access to its own visual output
10- [ ] Have it default to creating a new branch off main and then embedding and iframe to the resulting http val and give you a link to a pr opening url

OpenTowniesystem_prompt.txt2 matches

@arfanโ€ขUpdated 1 month ago
166```
167โ”œโ”€โ”€ backend/
168โ”‚ โ”œโ”€โ”€ database/
169โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
170โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
228- Handle API calls properly with proper error catching
229
230### Database Patterns
231- Run migrations on startup or comment out for performance
232- Change table names when modifying schemas rather than altering

OpenTownieindex.ts1 match

@arfanโ€ขUpdated 1 month ago
9export const thinkTool = tool({
10 description:
11 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
12 parameters: z.object({
13 thought: z.string().describe("A thought to think about."),

test_25326main.tsx2 matches

@arfanโ€ขUpdated 1 month ago
94 const result = await sqlite.execute(`SELECT * FROM ${CONFIG.bookmarksTable}`);
95
96 console.log(`Fetched ${result.rows.length} bookmarks from the database.`);
97
98 // Parse tags from JSON string and convert rows to Bookmark objects
105 console.log("Example of the first bookmark:", JSON.stringify(bookmarks[0], null, 2));
106 } else {
107 console.log("No bookmarks were found in the database.");
108 }
109

MiniAppStarterREADME.md1 match

@charmaineโ€ขUpdated 1 month ago
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/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.

bookmarksDatabase

@s3thiโ€ขUpdated 2 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 5 months ago