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=230&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 5688 results for "database"(2994ms)

discord-botdiscord-client.ts2 matches

@boucherUpdated 4 weeks ago
1// Discord client for Val.town
2import { saveDMMessages } from "./database.ts";
3
4// Discord API endpoints
36 console.log(`Fetched ${messages.length} messages`);
37
38 // Save messages to database
39 await saveDMMessages(messages);
40

discord-botquery-service.ts1 match

@boucherUpdated 4 weeks ago
1// Query service for Val.town
2import { getMessages, getLinks } from "./database.ts";
3import { analyzeConversation, summarizeConversation } from "./anthropic-service.ts";
4

discord-botdiscord-interactions.ts2 matches

@boucherUpdated 4 weeks ago
2import { verifyKey } from "https://esm.sh/discord-interactions@3.4.0";
3import { processQuery } from "./query-service.ts";
4import { getCategories } from "./database.ts";
5import { createCommandResponse, getEnv, log, truncateText } from "../shared/utils.ts";
6import type {
117
118 case 'categories': {
119 // Get categories from database instead of hardcoding
120 const categoriesFromDB = await getCategories();
121 const categoryNames = categoriesFromDB.length > 0

discord-botDISCORD_BOT_SETUP.md1 match

@boucherUpdated 4 weeks ago
154
1551. Customize the bot's responses by editing the API endpoints in `api-server.js`
1562. Add more categories for link classification in `database.js`
1573. Enhance the AI queries by modifying prompts in `query-service.js`
1584. Create a web interface that connects to your API endpoints

discord-botdatabase.js15 matches

@boucherUpdated 4 weeks ago
1import Database from 'better-sqlite3';
2import linkify from 'linkify-it';
3import 'dotenv/config';
4
5// For Val.town, we'll use the built-in SQLite functionality
6// In local dev, we'll use a file-based database
7const DB_PATH = process.env.NODE_ENV === 'production' ? ':memory:' : './messages.db';
8
11
12/**
13 * Initialize the database schema
14 */
15export function initializeDatabase() {
16 const db = new Database(DB_PATH);
17
18 // Create messages table
97
98/**
99 * Save messages to the database
100 * @param {Array} messages - Array of message objects to save
101 */
102export async function saveDMMessages(messages) {
103 const db = initializeDatabase();
104
105 // Prepare statements
165 transaction(messages);
166
167 console.log(`Saved ${messages.length} messages to database`);
168
169 db.close();
171
172/**
173 * Get messages from the database, with optional filtering
174 * @param {Object} filters - Optional filters for messages
175 * @returns {Array} - Array of message objects
176 */
177export function getMessages(filters = {}) {
178 const db = initializeDatabase();
179
180 let query = `
229
230/**
231 * Get links from the database, with optional filtering
232 * @param {Object} filters - Optional filters for links
233 * @returns {Array} - Array of link objects
234 */
235export function getLinks(filters = {}) {
236 const db = initializeDatabase();
237
238 let query = `
292 */
293export function updateLinkCategory(linkId, category) {
294 const db = initializeDatabase();
295
296 db.prepare('UPDATE links SET category = ? WHERE id = ?').run(category, linkId);
304 */
305export function getCategories() {
306 const db = initializeDatabase();
307
308 const categories = db.prepare('SELECT * FROM categories ORDER BY name').all();
318 */
319export function addCategory(name) {
320 const db = initializeDatabase();
321
322 db.prepare('INSERT OR IGNORE INTO categories (name, created_at) VALUES (?, ?)').run(name, Date.now());

vt-discordREADME.md1 match

@boucherUpdated 4 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.

MiniAppStarterREADME.md1 match

@jhoncethUpdated 4 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/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.

MiniAppStarterApp.tsx5 matches

@jhoncethUpdated 4 weeks ago
13 const navLinks = [
14 { name: "Farcaster SDK", path: "/" },
15 { name: "Database", path: "/db" },
16 { name: "About", path: "/about" },
17 ];
35 <Routes>
36 <Route path="/" element={<FarcasterMiniApp />} />
37 <Route path="/db" element={<Database />} />
38 <Route path="/about" element={<About />} />
39 <Route path="/neynar" element={<Neynar />} />
50 <div className="">✷ Hono + React + Tailwind</div>
51 <div className="">✷ React Router + React Query</div>
52 <div className="">✷ Built-in database (blob storage)</div>
53 <div className="">✷ Farcaster mini app manifest + webhook + embed metadata</div>
54 <div className="">✷ Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
66}
67
68function Database() {
69 const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
70 const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
71 return (
72 <Section className="flex flex-col items-start gap-3 m-5">
73 {/* <h2 className="font-semibold">Database Example</h2> */}
74 <div className="">Counter value: {data}</div>
75 <Button variant="outline" onClick={() => fetch("/api/counter/increment").then(refetch)}>

WillpersonalWebsiteHTTP1011 match

@willthereaderUpdated 4 weeks ago
26<ul>
27 <li><strong>HTTP</strong> is the movie-rental kiosk interface—how you browse, check out, and return movies.</li>
28 <li><strong>Client</strong> is the customer at the kiosk; <strong>Server</strong> is the machine’s inventory database.</li>
29 <li>An <strong>HTTP Request</strong> is your on-screen selection:</li>
30 <li><strong>Method</strong> → Action button (“<strong>GET</strong>” to view details, “<strong>PUT</strong>” to update return date, “<strong>POST</strong>” to add a new rental);</li>

OpenTownie_jacksonTODOs.md1 match

@stevekrouseUpdated 4 weeks ago
9- [ ] make it one click to branch off like old jp townie demos
10- [ ] opentownie as a pr bot
11- [ ] 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
12- [ ] do a browser use or screenshot thing to give it access to its own visual output
13- [ ] Have it default to creating a new branch off main

bookmarksDatabase

@s3thiUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkUpdated 6 months ago