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/image-url.jpg%20%22Optional%20title%22?q=database&page=360&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 4227 results for "database"(871ms)

charbuilddb.js5 matches

@dcm31•Updated 1 month ago
1/**
2 * Shared database utilities
3 * Each app can choose to use this or manage its own database operations
4 */
5
6import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
7
8// Base key for database tables to avoid conflicts
9const KEY_PREFIX = 'charbuild';
10
11/**
12 * Creates a database interface for a specific app
13 * @param {string} appName - The name of the app (used for table prefixing)
14 * @param {number} schemaVersion - The schema version for the app
15 * @returns {Object} Database interface object
16 */
17export function getDb(appName, schemaVersion = 1) {

queryParamsNotEncodedRepromain.tsx9 matches

@shouser•Updated 1 month ago
5const respWithoutError = await vt.projects.files.retrieve(
6 "3fed38fa-00e9-11f0-99ff-569c3dd06744",
7 "backend%2Fdatabase%2Fmigrations.ts", // <-- URI encoded
8 { limit: 10, offset: 0 },
9);
14 const respWithError = await vt.projects.files.retrieve(
15 "3fed38fa-00e9-11f0-99ff-569c3dd06744",
16 "backend/database/migrations.ts", // <-- not URI encoded
17 { limit: 10, offset: 0 },
18 );
28// id: "412a62a6-00e9-11f0-bbde-569c3dd06744",
29// parentId: "ba51ef61-14d6-4805-b94b-9d6c8b42e4e9",
30// path: "backend/database/migrations.ts",
31// version: 27,
32// updatedAt: "2025-03-14T19:26:35.553Z",
33// type: "script",
34// links: {
35// self: "https://api.val.town/v1/projects/3fed38fa-00e9-11f0-99ff-569c3dd06744/files/backend/database/migrations.ts",
36// html: "https://www.val.town/x/shouser/project_updates_webhook/code/backend/database/migrations.ts",
37// module: "https://esm.town/v/shouser/project_updates_webhook/backend/database/migrations.ts"
38// }
39// }
40// ],
41// links: {
42// self: "https://api.val.town/v1/projects/3fed38fa-00e9-11f0-99ff-569c3dd06744/files/backend%2Fdatabase%2Fmigrations.ts?limit=10&offset=0"
43// }
44// }
45// Not URI encoding causes error: Error: 404 Route GET:/v1/projects/3fed38fa-00e9-11f0-99ff-569c3dd06744/files/backend/database/migrations.ts?limit=10&offset=0 not found
46// at Function.generate (file:///opt/render/.cache/deno/npm/registry.npmjs.org/@valtown/sdk/0.36.0/error.mjs:45:20)
47// at ValTown.makeStatusError (file:///opt/render/.cache/deno/npm/registry.npmjs.org/@valtown/sdk/0.36.0/core.mjs:272:25)
57// },
58// error: {
59// message: "Route GET:/v1/projects/3fed38fa-00e9-11f0-99ff-569c3dd06744/files/backend/database/migrations.ts?limit=10&offset=0 not found",
60// error: "Not Found",
61// statusCode: 404

charlieMultiappindex.ts5 matches

@dcm31•Updated 1 month ago
2import { MainLayout } from '../../layouts/MainLayout';
3import { AppConfig, AppContext } from '../registry';
4import { initAppDatabase } from '../../utils/db';
5import { sqlite } from "https://esm.town/v/std/sqlite";
6
80`;
81
82// Setup database schema
83const SCHEMA = `
84CREATE TABLE IF NOT EXISTS questie_quests (
92`;
93
94// Initialize the database
95initAppDatabase('questie', SCHEMA);
96
97// Questie app handler
115 const status = formData.get('status') || 'pending';
116
117 // Save the new quest to database
118 await sqlite.execute(
119 `INSERT INTO questie_quests (email, title, description, status) VALUES (?, ?, ?, ?)`,

charlieMultiappDetail.ts1 match

@dcm31•Updated 1 month ago
8
9export async function QuestieDetail({ email, questId }: QuestieDetailProps) {
10 // Fetch quest details from the database
11 let quest = null;
12

charlieMultiappList.ts1 match

@dcm31•Updated 1 month ago
7
8export async function QuestieList({ email }: QuestieListProps) {
9 // Fetch quests from the database
10 let quests = [];
11 try {

charlieMultiappdb.ts4 matches

@dcm31•Updated 1 month ago
1import { sqlite } from "https://esm.town/v/std/sqlite";
2
3// Helper function to initialize an app's database
4export async function initAppDatabase(appName: string, schema: string) {
5 try {
6 await sqlite.execute(schema);
7 console.log(`Initialized database schema for ${appName}`);
8 return true;
9 } catch (error) {
10 console.error(`Error initializing database for ${appName}:`, error);
11 return false;
12 }

cerebras_coderindex2 matches

@Miraj•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> {

invitationTrackerDbmain.tsx1 match

@prashamtrivedi•Updated 1 month ago
4const SCHEMA_VERSION = 1;
5
6// Initialize the database
7async function initDB() {
8 await sqlite.execute(`

CyberMetaxmain.tsx2 matches

@CyberK14•Updated 2 months ago
91 },
92 {
93 name: "database_schema.sql",
94 type: "database_schema",
95 content: `
96CREATE TABLE users (

mandomain.tsx8 matches

@api•Updated 2 months ago
345
346 try {
347 // Initialize database with enhanced error handling and add cache table
348 await sqlite.execute(`
349 CREATE TABLE IF NOT EXISTS ${KEY}_tools_${SCHEMA_VERSION} (
382 `);
383
384 serverLog("INFO", "Database initialized successfully", {
385 key: KEY,
386 schemaVersion: SCHEMA_VERSION,
387 });
388 } catch (dbInitError) {
389 serverLog("ERROR", "Database initialization failed", {
390 error: dbInitError instanceof Error ? dbInitError.message : String(dbInitError),
391 key: KEY,
393 return new Response(
394 JSON.stringify({
395 error: "Database initialization failed",
396 details: String(dbInitError),
397 }),
730 const finalTool = oracleResponse.tool || maverickResponse.tool;
731
732 // Store the tool in the database
733 const toolId = finalTool.id || crypto.randomUUID();
734 await sqlite.execute(
793 const toolResponse: ToolResponse = JSON.parse(agentBContent);
794
795 // Store the tool request and response in the database
796 const requestId = crypto.randomUUID();
797 await sqlite.execute(
926 const toolResponse: ToolResponse = JSON.parse(completionContent);
927
928 // Store the tool request and response in the database
929 const requestId = toolRequest.id || crypto.randomUUID();
930 await sqlite.execute(
1297 }
1298
1299 // If creating a tool, store it in the database
1300 if (agentResponse.actionType === "create_tool" && agentResponse.tool) {
1301 const toolId = agentResponse.tool.id || crypto.randomUUID();

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago