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/?q=database&page=3&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 2773 results for "database"(478ms)

vtProjectSearch

vtProjectSearchdb.ts3 matches

@dcm31Updated 1 day ago
172
173/**
174 * Get database statistics for the homepage
175 */
176export async function getSearchStats(): Promise<{
881 const offset = (page - 1) * pageSize;
882
883 // Start all database queries in parallel
884 // 1. Launch count queries
885 const countsPromise = Promise.all([
968 );
969
970 // Wait for all database operations to complete in parallel
971 const [
972 [totalFileResults, totalValResults, totalUserResults],
vtProjectSearch

vtProjectSearchapi.tsx3 matches

@dcm31Updated 1 day ago
179 const needFullDocsData = searchTerm && (resultType === "docs" || format.toLowerCase() === "json");
180
181 // Run database search in parallel with appropriate docs search
182 const [searchResponse, docsResult] = await Promise.all([
183 // Database search for files, vals, users
184 searchTerm
185 ? searchFileContentWithContext(searchTerm, 2, page, pageSize, resultType !== "docs" ? resultType : undefined) // Show 2 lines of context
222 };
223
224 // Only get database stats when needed (no query or empty results)
225 const totalResults = combinedResponse.totalFileResults
226 + combinedResponse.totalValResults
vtProjectSearch

vtProjectSearchcomponents.tsx2 matches

@dcm31Updated 1 day ago
1242 <a href="?q=fetch" className="example-link">fetch</a>
1243 <a href="?q=api" className="example-link">api</a>
1244 <a href="?q=database" className="example-link">database</a>
1245 <a href="?q=image" className="example-link">image</a>
1246 <a href="?q=function" className="example-link">function</a>
1397 <a href="?q=fetch" className="example-link">fetch</a>
1398 <a href="?q=api" className="example-link">api</a>
1399 <a href="?q=database" className="example-link">database</a>
1400 <a href="?q=image" className="example-link">image</a>
1401 <a href="?q=function" className="example-link">function</a>

Notion_GCal_SyncREADME.md4 matches

@charmaineUpdated 1 day ago
221. Create a Notion integration at https://www.notion.so/my-integrations
232. Get your Notion API key
243. Create a database in Notion for meeting pages with these properties:
25 - Title (title)
26 - Meeting Date (date)
27 - Attendee (rich text)
28 - Email (email)
294. Share your database with the integration
305. Get the database ID from the URL (the part after the workspace name and before the question mark)
31
32### 3. SERP API Setup (for better user information)
41- `GOOGLE_REFRESH_TOKEN`: Refresh token for your Google account
42- `NOTION_API_KEY`: Your Notion API key
43- `NOTION_DATABASE_ID`: ID of the Notion database where meeting pages will be created
44- `TEAM_DOMAIN`: Your team's email domain (e.g., "val.town")
45- `SERP_API_KEY`: Your SERP API key for enhanced user information

Notion_GCal_Syncnotion.ts3 matches

@charmaineUpdated 1 day ago
19export async function createMeetingPage(data: MeetingPageData): Promise<string> {
20 const notionApiKey = Deno.env.get("NOTION_API_KEY");
21 const databaseId = Deno.env.get("NOTION_DATABASE_ID");
22
23 if (!notionApiKey || !databaseId) {
24 throw new Error("Missing Notion API credentials in environment variables");
25 }
50 // Prepare the content for the Notion page
51 const pageContent = {
52 parent: { database_id: databaseId },
53 properties: {
54 title: {

notionboxddiary-import.ts4 matches

@jclemUpdated 1 day ago
18
19const notion = new Client({ auth: process.env.NOTION_SECRET! });
20const dbID = process.env.NOTION_DATABASE_ID!;
21
22export default async function main() {
67 await notion.pages.create({
68 parent: {
69 database_id: dbID,
70 },
71
115
116async function existsByGUID(guid: string) {
117 const res = await notion.databases.query(
118 {
119 database_id: dbID,
120 page_size: 1,
121 filter: {

stevensDemosetupTelegramChatDb.ts2 matches

@lixPUpdated 1 day 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

@lixPUpdated 1 day 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

@lixPUpdated 1 day 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

stevensDemoREADME.md6 matches

@lixPUpdated 1 day ago
1# Database
2
3This app uses [Val Town SQLite](https://docs.val.town/std/sqlite/) to manage data. Every Val Town account comes with a free SQLite database, hosted on [Turso](https://turso.tech/). This folder is broken up into two files:
4
5* `migrations.ts` - code to set up the database tables the app needs
6* `queries.ts` - functions to run queries against those tables, which are imported and used in the main Hono server in `/backend/index.ts`
7
8## Migrations
9
10In `backend/database/migrations.ts`, this app creates a new SQLite table `reactHonoStarter_messages` to store messages.
11
12This "migration" runs once on every app startup because it's imported in `index.ts`. You can comment this line out for a slight (30ms) performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.
13
14SQLite has much more limited support for altering existing tables as compared to other databases. Often it's easier to create new tables with the schema you want, and then copy the data over. Happily LLMs are quite good at those sort of database operations, but please reach out in the [Val Town Discord](https://discord.com/invite/dHv45uN5RY) if you need help.
15
16## Queries
17
18The queries file is where running the migrations happen in this app. It'd also be reasonable for that to happen in index.ts, or as is said above, for that line to be commented out, and only run when actual changes are made to your database schema.
19
20The queries file exports functions to get and write data. It relies on shared types and data imported from the `/shared` directory.