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=210&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 7155 results for "database"(1519ms)

amzn-top-100-trckr

amzn-top-100-trckrscheduler.ts5 matches

@nuckyโ€ขUpdated 2 weeks ago
1// Daily cron job to scrape Amazon bestsellers
2import { initializeDatabase } from "./backend/database/migrations.ts";
3import { saveBooks } from "./backend/database/queries.ts";
4import { scrapeBooks } from "./backend/scraper.ts";
5
8
9 try {
10 // Ensure database is initialized
11 await initializeDatabase();
12
13 // Add a small delay to avoid immediate rate limiting
18
19 if (result.success && result.books && result.books.length > 0) {
20 // Save the books to the database
21 await saveBooks(result.books);
22 console.log(`โœ… Scraping completed successfully: ${result.booksFound} books found and saved`);
amzn-top-100-trckr

amzn-top-100-trckrmigrations.ts2 matches

@nuckyโ€ขUpdated 2 weeks ago
3const TABLE_NAME = 'amazon_books_v1';
4
5export async function initializeDatabase() {
6 // Create the main books table
7 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
23 await sqlite.execute(`CREATE INDEX IF NOT EXISTS idx_rank ON ${TABLE_NAME} (rank, scraped_at)`);
24
25 console.log("Database initialized successfully");
26}
27

reactHonoStarterREADME.md1 match

@jessicagarsonโ€ขUpdated 2 weeks 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/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.

CoolTownindex.ts4 matches

@mikesoyluโ€ขUpdated 2 weeks ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { initializeDatabase } from "./database/migrations.ts";
4import { getAllTodos } from "./database/queries.ts";
5import todosRouter from "./routes/todos.ts";
6
12});
13
14// Initialize database on startup
15await initializeDatabase();
16
17// API routes

CoolTowntodos.ts1 match

@mikesoyluโ€ขUpdated 2 weeks ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllTodos, createTodo, updateTodo, deleteTodo } from "../database/queries.ts";
3import type { CreateTodoRequest, UpdateTodoRequest } from "../../shared/types.ts";
4

CoolTownmigrations.ts1 match

@mikesoyluโ€ขUpdated 2 weeks ago
3export const TABLE_NAME = 'todos_v1';
4
5export async function initializeDatabase() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (

CoolTownREADME.md4 matches

@mikesoyluโ€ขUpdated 2 weeks ago
15```
16โ”œโ”€โ”€ backend/
17โ”‚ โ”œโ”€โ”€ database/
18โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Database schema
19โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database operations
20โ”‚ โ”œโ”€โ”€ routes/
21โ”‚ โ”‚ โ””โ”€โ”€ todos.ts # Todo API routes
40## Development
41
42The app runs on Val Town with automatic deployment. The database is automatically initialized on first run.

book-lookup-notionnotion.ts10 matches

@nuckyโ€ขUpdated 2 weeks ago
1/**
2 * Notion API integration for book database
3 */
4
28
29export interface BookMetadata {
30 // Core fields (mapped to Notion database)
31 title?: string;
32 author?: string;
59
60/**
61 * Get records from Notion database that need metadata enrichment
62 * This includes:
63 * 1. Records with Title + Author but missing other metadata
66export async function getIncompleteRecords(): Promise<NotionBookRecord[]> {
67 const token = Deno.env.get('NOTION_API_TOKEN');
68 const databaseId = Deno.env.get('NOTION_DATABASE_ID');
69
70 if (!token || !databaseId) {
71 throw new Error('Missing NOTION_API_TOKEN or NOTION_DATABASE_ID environment variables');
72 }
73
74 console.log('Debug info:', {
75 tokenPrefix: token.substring(0, 10) + '...',
76 databaseIdLength: databaseId.length,
77 databaseIdPrefix: databaseId.substring(0, 8) + '...'
78 });
79
80 const response = await fetch(`${NOTION_API_BASE}/databases/${databaseId}/query`, {
81 method: 'POST',
82 headers: {
464
465 if (!additionalResponse.ok) {
466 console.log(`Property "${propName}" doesn't exist in database, skipping...`);
467 }
468 } catch (error) {

book-lookup-notionindex.ts16 matches

@nuckyโ€ขUpdated 2 weeks ago
1/**
2 * Notion Book Database Auto-Populator
3 * Main HTTP handler and API endpoints
4 */
44app.get('/status', async (c) => {
45 const hasNotionToken = !!Deno.env.get('NOTION_API_TOKEN');
46 const hasNotionDatabase = !!Deno.env.get('NOTION_DATABASE_ID');
47
48 const status = {
49 configured: hasNotionToken && hasNotionDatabase,
50 notion_token: hasNotionToken ? 'Set' : 'Missing',
51 notion_database: hasNotionDatabase ? 'Set' : 'Missing',
52 timestamp: new Date().toISOString()
53 };
60 setup_instructions: {
61 notion_token: 'Set NOTION_API_TOKEN environment variable with your Notion integration token',
62 notion_database: 'Set NOTION_DATABASE_ID environment variable with your book database ID'
63 }
64 }, 400);
110app.get('/debug', (c) => {
111 const token = Deno.env.get('NOTION_API_TOKEN');
112 const databaseId = Deno.env.get('NOTION_DATABASE_ID');
113
114 return c.json({
118 prefix: token?.substring(0, 10) + '...' || 'N/A'
119 },
120 database_info: {
121 exists: !!databaseId,
122 length: databaseId?.length || 0,
123 prefix: databaseId?.substring(0, 8) + '...' || 'N/A'
124 }
125 });
171app.get('/help', (c) => {
172 return c.json({
173 title: 'Notion Book Database Auto-Populator',
174 description: 'Automatically enriches your Notion book database with metadata from Google Books API',
175 endpoints: {
176 'GET /': 'Process all incomplete records',
183 step1: 'Create a Notion integration at https://www.notion.so/my-integrations',
184 step2: 'Copy the integration token and set it as NOTION_API_TOKEN environment variable',
185 step3: 'Share your book database with the integration',
186 step4: 'Copy the database ID from the URL and set it as NOTION_DATABASE_ID environment variable',
187 step5: 'Ensure your database has these properties: Title (title), Author (rich text), ISBN (rich text), Year Published (number), Page Count (number), Publisher (rich text)'
188 },
189 database_properties: {
190 required: ['Title (title)', 'Author (rich text)'],
191 populated: ['ISBN (rich text)', 'Year Published (number)', 'Page Count (number)', 'Publisher (rich text)'],

book-lookup-notioncron-processor.ts4 matches

@nuckyโ€ขUpdated 2 weeks ago
15 if (result.totalProcessed > 0) {
16 const summary = `
17๐Ÿ“š Book Database Update Complete
18
19๐Ÿ“Š Summary:
39
40 await email({
41 subject: `๐Ÿ“š Book Database Updated - ${result.successful} books enriched`,
42 text: summary
43 });
52 // Send error notification
53 await email({
54 subject: 'โŒ Book Database Update Failed',
55 text: `
56The scheduled book database update failed with the following error:
57
58${error instanceof Error ? error.message : 'Unknown error'}

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago