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=520&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 7088 results for "database"(843ms)

promptfixerdatabase.ts5 matches

@prashamtrivediUpdated 1 month ago
5const PROMPTS_TABLE = 'prompt_requests_v1';
6
7// Initialize database tables
8export async function initDatabase() {
9 try {
10 await sqlite.execute(`
20 )
21 `);
22 console.log("Database initialized");
23 } catch (error) {
24 console.error("Database initialization error:", error);
25 throw error;
26 }
101}
102
103// Helper function to map a database row to a PromptRequest object
104function mapRowToPromptRequest(row: any[], columns: string[]): PromptRequest {
105 const result: Record<string, any> = {};

promptfixertypes.ts1 match

@prashamtrivediUpdated 1 month ago
23}
24
25// For database operations
26export interface SQLQueryResult {
27 columns: string[];

promptfixerREADME.md4 matches

@prashamtrivediUpdated 1 month ago
102. **Email Submission** - Users can email their prompt details, which are automatically parsed using Gemini AI.
11
12All submissions are stored in a SQLite database and can be accessed through an admin panel where administrators can:
13
14- View all prompt requests
20- `backend/` - Server-side code
21 - `index.ts` - Main API server (Hono)
22 - `database.ts` - SQLite database operations
23 - `email-service.ts` - Email processing and sending
24 - `email-handler.ts` - Email endpoint handler
43 - View all submitted requests
44 - Create and send improved prompts to users
45- **SQLite Database** for data storage
46- **Email Notifications**
47 - To admins when new requests arrive
62- Val Town Platform
63- Hono (API framework)
64- SQLite (database)
65- OpenAI (for email processing)
66- TailwindCSS (styling)

ValTownForNotionindex.ts4 matches

@stevekrouseUpdated 1 month ago
10import exampleCallout from "./routes/exampleCallout.ts";
11import exampleChildPages from "./routes/exampleChildPages.ts";
12import exampleDatabasePage from "./routes/exampleDatabasePage.ts";
13import exampleDatabasePages from "./routes/exampleDatabasePages.ts";
14import home from "./routes/home.ts";
15import testRoutes from "./routes/testRoutes.ts";
27// Mount all route modules
28app.route("/", home);
29app.route("/", exampleDatabasePages);
30app.route("/", exampleDatabasePage);
31app.route("/", exampleChildPages);
32app.route("/", exampleCallout);

ValTownForNotionREADME.md2 matches

@stevekrouseUpdated 1 month ago
5## Route Files
6
7- `exampleDatabasePages.ts` - Handles `/example/database/pages` endpoint for resetting database pages
8- `exampleDatabasePage.ts` - Handles `/example/database/page` endpoint for updating a single database page
9- `exampleChildPages.ts` - Handles `/example/child_pages` endpoint for managing child pages
10- `exampleCallout.ts` - Handles `/example/callout` endpoint for updating callout blocks
5const app = new Hono();
6
7app.post("/example/database/page", async (c) => {
8 const payload = await c.req.json();
9 const data = await payload?.data;
17
18 // store webhook data in blob storage for resets
19 // capture the database id to store in the blob
20 const databaseId = data?.parent?.database_id;
21 const blobObject = {
22 id: databaseId,
23 date: new Date(),
24 content: askingFor,
10const app = new Hono();
11
12app.post("/example/database/pages", async (c) => {
13 // blob keys map to endpoints for the cron resets
14 const blobKey = await c.req.url.replace("https://", "");
15 const askingFor = c.req.headers.get("asking_for") || "default"; // val.town or default
16
17 // capture the database id to store in the blob
18 const targetId = c.req.headers.get("target_id");
19
20 // get the pages in this database
21 const databaseChildren = await notion.databases.query({ database_id: targetId });
22 // delete all pages to prevent bad actors from leaving naughty rows behi
23 for (const [key, child] of databaseChildren.results.entries()) {
24 const page = await notion.pages.update({
25 page_id: child.id,
28 }
29
30 // get the database
31 const database = await notion.databases.retrieve({ database_id: targetId });
32 // convert the statuses string in the status property into JSON
33 const statuses = JSON.parse(database?.properties?.Statuses?.formula?.expression);
34 // get the first item on the list of statuses, to set the status for new pages
35 const status = statuses[0];
36 // add back pages; fresh start for the next person to add favicons
37 const defaults = ["val.town", "notion.com", "hono.dev"].reverse();
38 // create new database pages from default object
39 for (const item of defaults) {
40 const page = await notion.pages.create({
41 parent: {
42 type: "database_id",
43 database_id: targetId,
44 },
45 properties: {

stevensDemosetupTelegramChatDb.ts2 matches

@ifkvUpdated 1 month ago
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
25 `);
26
27 return "Telegram chat database table created successfully.";
28 } catch (error) {
29 console.error("Error setting up telegram_chats table:", error);

stevensDemoREADME.md3 matches

@ifkvUpdated 1 month ago
13## Technical Architecture
14
15**⚠️ important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure. if you fork this project and put sensitive data in a database you should think carefully about how to secure it.**
16
17Stevens has been designed with the utmost simplicity and extensibility, much like a well-organized household. At the heart of his operation lies a single "memories" table - a digital equivalent of a butler's meticulous records. This table serves as the foundation for all of Stevens' operations.
45- `dashboard`: the admin view for showing the memories notebook + visualizing imports
46- `dailyBriefing`: stuff related to sending a daily update via telegram
47- `dbUtils`: little one-off scripts for database stuff
48
49## Hiring your own Stevens
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.
58
59**important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure, if you put sensitive data in a database you should think carefully about how to secure it.**
60
61Overall it's a simple enough project that I encourage you to just copy the ideas and run in your own direction rather than try to use it as-is.

stevensDemoREADME.md2 matches

@ifkvUpdated 1 month ago
4
5* `index.ts` - this is the **entrypoint** for this whole project
6* `database/` - this contains the code for interfacing with the app's SQLite database table
7
8## Hono
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors

bookmarksDatabase

@s3thiUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkUpdated 6 months ago