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/$2?q=database&page=13&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 5779 results for "database"(2629ms)

Towniethink.ts1 match

@chadparkerβ€’Updated 1 day 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."),

Towniesystem_prompt.txt2 matches

@chadparkerβ€’Updated 1 day ago
174```
175β”œβ”€β”€ backend/
176β”‚ β”œβ”€β”€ database/
177β”‚ β”‚ β”œβ”€β”€ migrations.ts # Schema definitions
178β”‚ β”‚ β”œβ”€β”€ queries.ts # DB query functions
234 ```
235
236### Database Patterns
237- Run migrations on startup or comment out for performance
238- Change table names when modifying schemas rather than altering

Towniesend-message.ts1 match

@chadparkerβ€’Updated 1 day ago
10 overLimit,
11 startTrackingUsage,
12} from "../database/queries.tsx";
13import { makeChangeValTypeTool, makeFetchTool, makeTextEditorTool } from "../tools/index.ts";
14import fileWithLinesNumbers from "../utils/fileWithLinesNumbers.ts";

Towniequeries.tsx1 match

@chadparkerβ€’Updated 1 day ago
4import { INFERENCE_CALLS_TABLE, USAGE_TABLE } from "./schema.tsx";
5
6// Eventually we'll have a user database,
7// but in the meantime, we can cache user info in memory
8const userIdCache: { [key: string]: any } = {};

Townie.cursorrules2 matches

@chadparkerβ€’Updated 1 day ago
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

Okmigrations.ts3 matches

@oknareshmeenaβ€’Updated 1 day ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for Kids Phone Safety App
4// Note: Change table names when modifying schemas (add _2, _3, etc.)
5
14
15/**
16 * Initialize all database tables
17 */
18export async function initializeDatabase(): Promise<void> {
19 await createParentsTable();
20 await createDevicesTable();

OkREADME.md3 matches

@oknareshmeenaβ€’Updated 1 day ago
16β”œβ”€β”€ backend/
17β”‚ β”œβ”€β”€ index.ts # Main Hono server
18β”‚ β”œβ”€β”€ database/
19β”‚ β”‚ β”œβ”€β”€ migrations.ts # Database schema
20β”‚ β”‚ └── queries.ts # Database operations
21β”‚ └── routes/
22β”‚ β”œβ”€β”€ auth.ts # Authentication routes

Upworkindex.ts1 match

@PortfolioFreelanceβ€’Updated 2 days ago
39 // 1. Validate the form data
40 // 2. Send an email notification
41 // 3. Store the message in a database
42 // 4. Return a success response
43

blogget-old-posts.ts1 match

@charmaineβ€’Updated 2 days ago
46 "slug": "codegen",
47 "link": "/blog/codegen",
48 "description": "Like Claude Artifacts, but with a backend and database",
49 "pubDate": "Thu, 22 Aug 2024 00:00:00 GMT",
50 "author": "JP Posma",
1---
2title: "Post-mortem: A Backward Incompatible Database Migration"
3description: Val runs failed due to a database migration that was not backward compatible
4pubDate: 2025-04-02T00:00:00.000Z
5author: Sophie Houser
6---
7
8Today at 10:11am we experienced a 12-minute outage, which caused HTTP vals to return 503 errors and other types of vals to fail. In the end, the root cause was a deployment timing issue where database migrations were deployed successfully, but our application code deployment hung for several minutes. The new database migrations were incompatible with the old application code and crashed the process.
9
10We aim to make all database migrations maintain backward compatibility, but in this case, we only discovered through the delayed deployment feedback that the new migrations were not compatible with previous versions.
11
12## Timeline
27## Next Steps
28
29Reliability is important to us and we’ve taken steps to make sure this doesn’t happen again. We’ve added a test to ensure database migrations are backward compatible, which we’ll run before we deploy any new code that includes database migrations.

bookmarksDatabase

@s3thiβ€’Updated 3 months ago

sqLiteDatabase1 file match

@ideofunkβ€’Updated 6 months ago