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=api&page=85&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 11029 results for "api"(699ms)

templateRedditAlertmain.tsx8 matches

@abeperlUpdated 1 week ago
1import { searchWithSerpApi } from "https://esm.town/v/charmaine/searchWithSerpApi";
2import { email } from "https://esm.town/v/std/email";
3
4// Customize your search parameters
5const KEYWORDS = "\"mcp server\" OR \"roo code\" OR \"code augment\"";
6const SERP_API_KEY = Deno.env.get("SERP_API_KEY");
7
8// Set isProd = false for testing and = true for production
12
13export async function redditAlert({ lastRunAt }: Interval) {
14 if (!SERP_API_KEY) {
15 console.error("Missing SERP_API_KEY. Exiting.");
16 return;
17 }
18
19 // Determine the time frame for the search
20 // Details on as_qdr: https://serpapi.com/advanced-google-query-parameters#api-parameters-advanced-search-query-parameters-as-qdr
21 const timeFrame = isProd
22 ? lastRunAt
26
27 try {
28 const response = await searchWithSerpApi({
29 query: KEYWORDS,
30 site: "reddit.com",
31 apiKey: SERP_API_KEY,
32 daysBack: parseInt(timeFrame.replace("d", "")),
33 // Details on as_filetype: https://serpapi.com/advanced-google-query-parameters#api-parameters-advanced-search-query-parameters-as-filetype
34 });
35
ValTownForNotion

ValTownForNotionresets4 matches

@bradnobleUpdated 1 week ago
4// Initialize Notion client
5const notion = new Client({
6 auth: Deno.env.get("NOTION_API_KEY"),
7});
8
37 // the block exists, so you can do the reset
38
39 // reset via the API
40 // this way we keep the notion data and the blob data (our cache) in sync
41 // the API resets the blocks on notion pages, and also knows what to do with the blob
42 // (note the x-blob-key header)
43 if (content != "default" && diffInMinutes > .5) {
48 "x-asking-for": "default",
49 "x-blob-key": item.key,
50 "x-api-key": Deno.env.get("X_API_KEY"),
51 },
52 body: JSON.stringify({

sqliteExplorerAppREADME.md1 match

@kucukkanatUpdated 1 week ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@kucukkanatUpdated 1 week ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

vt-bloglive-reload.ts1 match

@charmaineUpdated 1 week ago
82 // if we wanted to create a /lastUpdatedAt route,
83 // which would let us pass a val town bearer token, we could do that here
84 // gives us 10k API requests per minute instead of 1k
85 // and would work with private projects
86

vt-blogget-old-posts.ts25 matches

@charmaineUpdated 1 week ago
19export const oldPosts: BlogPost[] = [
20 {
21 "title": "Solving the internal / external API riddle",
22 "slug": "api-conundrum",
23 "link": "/blog/api-conundrum",
24 "description": "Figuring out how to provide an API that's usable by everyone and fast for us to iterate on",
25 "pubDate": "Thu, 27 Mar 2025 00:00:00 GMT",
26 "author": "Tom MacWright",
27 },
28 {
29 "title": "API Tokens Scopes",
30 "slug": "api-token-scopes",
31 "link": "/blog/api-token-scopes",
32 "description": "Improving security with granular control over permissions",
33 "pubDate": "Fri, 01 Nov 2024 00:00:00 GMT",
59 },
60 {
61 "title": "Expanding the Vals API - RFC",
62 "slug": "expanding-the-vals-api-rfc",
63 "link": "/blog/expanding-the-vals-api-rfc",
64 "description": "Our REST API lets you do a lot - and soon it will enable more",
65 "pubDate": "Fri, 30 Jun 2023 00:00:00 GMT",
66 "author": "André Terron",
133 },
134 {
135 "title": "The perks of a good OpenAPI spec",
136 "slug": "openapi",
137 "link": "/blog/openapi",
138 "description": "Taking advantage of our typed REST API to build a platform around\nVal Town.",
139 "pubDate": "Thu, 25 Jul 2024 00:00:00 GMT",
140 "author": "Tom MacWright",
262 },
263 {
264 "title": "The API we forgot to name",
265 "slug": "the-api-we-forgot-to-name",
266 "link": "/blog/the-api-we-forgot-to-name",
267 "description": "An API that takes a Request and returns a Response - what was that, again?",
268 "pubDate": "Thu, 19 Oct 2023 00:00:00 GMT",
269 "author": "Steve Krouse",
286 },
287 {
288 "title": "Deprecating the Run API",
289 "slug": "deprecating-the-run-api",
290 "link": "/blog/deprecating-the-run-api",
291 "description": "Not every function should be an API",
292 "pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293 "author": "André Terron",
321 "slug": "val-town-newsletter-1",
322 "link": "/blog/val-town-newsletter-1",
323 "description": "Programmatic notifications, Hacker News API, and more.",
324 "pubDate": "Wed, 04 Jan 2023 00:00:00 GMT",
325 "author": "Steve Krouse",
450 "slug": "val-town-newsletter-22",
451 "link": "/blog/val-town-newsletter-22",
452 "description": "Townie upgrades, Scoped API permissions, Fal partnership",
453 "pubDate": "Mon, 02 Dec 2024 00:00:00 GMT",
454 "author": "Steve Krouse",

vt-blog2025-04-08-migration.md1 match

@charmaineUpdated 1 week ago
83We didn't. We left them where they are, and proxy to them.
84
85Writing a proxy in Val Town (or any functions platform with the ['fetch handler' interface](https://blog.val.town/blog/the-api-we-forgot-to-name/)) is a delight:
86
87```ts

sauce_iframesmain.tsx4 matches

@dcm31Updated 1 week ago
8const apps = [
9 { name: "A1 GPT", iconUrl: "https://dcm31-imagehosting.web.val.run/image/image_1745248591905_a1gptlogo.png", appUrl: "https://dcm31-a1gpt.web.val.run/" },
10 { name: "Chatlula", iconUrl: "https://firebasestorage.googleapis.com/v0/b/charlies-projects-adbca.firebasestorage.app/o/Chatlula%2C%20Asistente%20IA%20Retro.png?alt=media&token=8fde113b-d2f5-4dee-bdd7-7971c2912a1b", appUrl: "https://dcm31-chatlula.web.val.run/" },
11 { name: "Srirachai", iconUrl: "https://firebasestorage.googleapis.com/v0/b/charlies-projects-adbca.firebasestorage.app/o/Srirach.AI_%20Spice%20Up%20Your%20Day.png?alt=media&token=1ee1404d-9f27-41fc-b548-5cfd343ae4c1", appUrl: "https://dcm31-srirachai.web.val.run/" },
12 { name: "DeepSauce", iconUrl: "https://firebasestorage.googleapis.com/v0/b/charlies-projects-adbca.firebasestorage.app/o/deepsauce.png?alt=media&token=07a14103-4c19-4029-99a6-57bd31ed1061", appUrl: "https://dcm31-deepsauce.web.val.run/" },
13];
14
211if (typeof document !== "undefined") { client(); }
212export default async function server(request: Request): Promise<Response> {
213 return new Response( ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no, maximum-scale=1.0"> <title>Sauce Apps - Microapp Platform (v2.1.1)</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> <style> body, html { margin: 0; padding: 0; height: 100%; width: 100%; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none; overflow: hidden; position: fixed; } #root { height: 100%; width: 100%; overflow: hidden; position: fixed; } * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; } </style> </head> <body> <div id="root"></div> <script src="https://esm.town/v/std/catch"></script> <script type="module" src="${import.meta.url}"></script> </body> </html> `, { headers: { "content-type": "text/html; charset=utf-8" }, }, );
214}

mediainfomain.tsx2 matches

@jamiedubsUpdated 1 week ago
38 <meta charSet="UTF-8" />
39 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
40 <title>Media Info API</title>
41 <script src="https://cdn.tailwindcss.com"></script>
42 </head>
43 <body className="bg-gray-100 font-sans">
44 <div className="container mx-auto px-4 py-8 max-w-3xl">
45 <h1 className="text-3xl font-bold mb-6 text-center">Media Info API</h1>
46 <form id="mediaForm" className="mb-8">
47 <input

MyStevensREADME.md5 matches

@billogiovanniUpdated 1 week ago
8## Hono
9
10This app uses [Hono](https://hono.dev/) as the API framework. You can think of Hono as a replacement for [ExpressJS](https://expressjs.com/) that works in serverless environments like Val Town or Cloudflare Workers. If you come from Python or Ruby, Hono is also a lot like [Flask](https://github.com/pallets/flask) or [Sinatra](https://github.com/sinatra/sinatra), respectively.
11
12## Serving assets to the frontend
20### `index.html`
21
22The most complicated part of this backend API is serving index.html. In this app (like most apps) we serve it at the root, ie `GET /`.
23
24We *bootstrap* `index.html` with some initial data from the server, so that it gets dynamically injected JSON data without having to make another round-trip request to the server to get that data on the frontend. This is a common pattern for client-side rendered apps.
25
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
31
32Hono and other API frameworks have a habit of swallowing up Errors. We turn off this default behavior by re-throwing errors, because we think most of the time you'll want to see the full stack trace instead of merely "Internal Server Error". You can customize how you want errors to appear.

daily-advice-app1 file match

@dcm31Updated 2 days ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaineUpdated 3 days ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration