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/$%7BsvgDataUrl%7D?q=api&page=35&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 19327 results for "api"(4078ms)

api_ianmenethil_comappConfig.ts7 matches

@ianmenethilUpdated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\core\app.config.ts
2
3import type { AppConfigShape, LogLevel } from "./appTypes.ts";
6export const APP_CONFIG: AppConfigShape = {
7 server: {
8 NAME: "Secure API Server",
9 DESCRIPTION:
10 "A secure, modular API server with OAuth, storage, and external service integration",
11 VERSION: "2.0.0",
12 BASE_URL: Deno.env.get("SERVER_BASE_URL") || "https://api.ianmenethil.com",
13 ENVIRONMENT: Deno.env.get("DENO_ENV") || "development",
14 PORT: parseInt(Deno.env.get("PORT") || "8000"),
15 HOST: Deno.env.get("HOST") || "0.0.0.0",
16 },
17 api: {
18 PUBLIC_API_PREFIX: "/v1",
19 INTERNAL_API_PREFIX: "/",
20 WEBHOOK_PREFIX: "/webhooks",
21 CALLBACK_PREFIX: "/callbacks",

api_ianmenethil_comindex.ts1 match

@ianmenethilUpdated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\config\index.ts
2export { APP_CONFIG, getConfig } from "../core/appConfig.ts";
3export * from "../core/appTypes.ts";

hm-invoicesv1types.ts2 matches

@arfanUpdated 1 day ago
49}
50
51// API response interfaces
52export interface ApiResponse<T> {
53 success: boolean;
54 data?: T;

hm-invoicesv1val-town.mdc10 matches

@arfanUpdated 1 day ago
18- Generate code in TypeScript or TSX
19- Add appropriate TypeScript types and interfaces for all data structures
20- Prefer official SDKs or libraries than writing API calls directly
21- Ask the user to supply API or library documentation if you are at all unsure about it
22- **Never bake in secrets into the code** - always use environment variables
23- Include comments explaining complex logic (avoid commenting obvious operations)
28### 1. HTTP Trigger
29
30- Create web APIs and endpoints
31- Handle HTTP requests and responses
32- Example structure:
138However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
139If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
140or by making an API request for it.
141
142## Val Town Platform Specifics
146- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
147- **Storage:** DO NOT use the Deno KV module for storage
148- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
149- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
150- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
151- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
152- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
153- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
154- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
155- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
376### Backend (Hono) Best Practices
377
378- Hono is the recommended API framework
379- Main entry point should be `main.tsx`
380- **Database Setup:** Use the admin utilities to handle table creation and seeding. Backend should focus on CRUD operations only
402 });
403 ```
404- Create RESTful API routes for CRUD operations
405- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
406 ```ts
442 - For files in the project, use `readFile` helpers
443
4445. **API Design:**
445 - `fetch` handler is the entry point for HTTP vals
446 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
68---
69
70## Phase 2: Core Backend API
71**Goal**: Build RESTful API endpoints for invoice management
72
73### Tasks:
741. **Main API Setup**
75 - Create `main.tsx` with Hono app configuration
76 - Set up error handling and static file serving
77 - Configure CORS if needed
78
792. **Invoice API Endpoints**
80 - `GET /api/invoices` - List all invoices with filtering
81 - `POST /api/invoices` - Create new invoice
82 - `PUT /api/invoices/:id` - Update invoice (mainly status changes)
83 - `DELETE /api/invoices/:id` - Delete invoice
84 - `GET /api/invoices/stats` - Dashboard statistics
85
863. **Vendor API Endpoints**
87 - `GET /api/vendors` - List all vendors
88 - `PUT /api/vendors/:id` - Update vendor name
89
90### Deliverables:
91- Complete REST API for invoice management
92- API endpoints tested via admin tools or direct calls
93- Proper error handling and validation
94
182
183## Technical Stack
184- **Backend**: Hono.js for API routes
185- **Database**: SQLite with Val Town's sqlite service
186- **Frontend**: React 18.2.0 with TypeScript
207
2081. **Phase 1: Foundation & Database Setup** - Get the core database structure and admin tools working
2092. **Phase 2: Core Backend API** - Build the REST API endpoints for managing invoices and vendors
2103. **Phase 3: Frontend Foundation** - Create the basic React UI with invoice display and forms
2114. **Phase 4: Enhanced UI & Interactions** - Add advanced features like dashboard, filtering, and bulk operations
223- Uses Val Town best practices with proper project structure
224- SQLite database with proper schema and constraints
225- Hono.js backend with RESTful API design
226- React frontend with TailwindCSS for styling
227- Admin utilities for easy database management and seeding
238- add a checkbox that the llm can mark off after completeing a phase.
239- no need for code to "Update vendor name" i will do that manually in admin code
240- no need to " - `DELETE /api/invoices/:id` - Delete invoice" , i'll do that using SQL commands , so add to plan to create a section in "db-tools.tsx" with some SQL commands that i can easily copy to run and a link to the database explorer "https://arfan25-admin-sqliteexplorerapp.val.run/"
241
242---
261## Phase Completion Checklist
262- [ ] Phase 1: Foundation & Database Setup
263- [ ] Phase 2: Core Backend API
264- [ ] Phase 3: Frontend Foundation
265- [ ] Phase 4: Enhanced UI & Interactions
284
285```markdown
2862. **Invoice API Endpoints**
287 - `GET /api/invoices` - List all invoices with filtering
288 - `POST /api/invoices` - Create new invoice
289 - `PUT /api/invoices/:id` - Update invoice (mainly status changes)
290 - `DELETE /api/invoices/:id` - Delete invoice
291 - `GET /api/invoices/stats` - Dashboard statistics
292
2933. **Vendor API Endpoints**
294 - `GET /api/vendors` - List all vendors
295 - `PUT /api/vendors/:id` - Update vendor name
296
297->
298
2992. **Invoice API Endpoints**
300 - `GET /api/invoices` - List all invoices with filtering
301 - `POST /api/invoices` - Create new invoice
302 - `PUT /api/invoices/:id` - Update invoice (mainly status changes)
303 - `GET /api/invoices/stats` - Dashboard statistics
304
3053. **Vendor API Endpoints**
306 - `GET /api/vendors` - List all vendors
307```
308
353```markdown
354## Technical Stack
355- **Backend**: Hono.js for API routes
356- **Database**: SQLite with Val Town's sqlite service
357- **Frontend**: React 18.2.0 with TypeScript
362
363## Technical Stack
364- **Backend**: Hono.js for API routes
365- **Database**: SQLite with Val Town's sqlite service
366- **Frontend**: React 18.2.0 with TypeScript
406- Updated technical stack to mention DaisyUI, nord theme, and Iconify v3
407
408✅ **Removed vendor name update API** - No longer planning to build `PUT /api/vendors/:id` endpoint since you'll handle this manually in admin tools
409
410✅ **Removed delete invoice API** - No longer planning `DELETE /api/invoices/:id` endpoint since you'll use SQL commands directly
411
412✅ **Enhanced admin tools** - Added to Phase 1:

api_ianmenethil_compackage.json2 matches

@ianmenethilUpdated 1 day ago
1{
2 "name": "modular-api-server",
3 "version": "1.0.0",
4 "description": "A modular API server with OpenAPI-driven routing",
5 "main": "main.tsx",
6 "type": "module",

api_ianmenethil_commain.tsx9 matches

@ianmenethilUpdated 1 day ago
1// F:\zApps\valtown.servers\APIServer\main.tsx
2import { Hono } from "hono";
3import type { HonoVariables } from "@/core/requestTypes.ts";
4import { APP_CONFIG } from "@/config/index.ts";
5import { generateRoutesFromOpenAPI } from "./src/openapi/routeGenerator.ts";
6
7const app = new Hono<{ Variables: HonoVariables }>();
18 initializationPromise = (async () => {
19 try {
20 const specPath = "./src/openapi/spec";
21 const result = await generateRoutesFromOpenAPI(app, specPath);
22 const routes = result.routes;
23 console.log(`✅ Initialized ${routes.length} routes from OpenAPI spec`);
24 routesInitialized = true;
25 return true;
26 } catch (error) {
27 console.error("❌ Failed to initialize routes from OpenAPI:", error);
28 app.all("*", (c) => {
29 return c.json(
32 error: {
33 code: "SERVICE_UNAVAILABLE",
34 message: "API routes not available - OpenAPI initialization failed",
35 details: error instanceof Error ? error.message : "Unknown error",
36 },
82 console.log(`📚 Swagger --> ${APP_CONFIG.server.BASE_URL}/docs`);
83 console.log(`🔗 Redocly --> ${APP_CONFIG.server.BASE_URL}/redoc`);
84 console.log(`🌐 OpenAPI Spec --> ${APP_CONFIG.server.BASE_URL}/openapi.json`);
85 console.log(`🌐 OpenAPI Spec --> ${APP_CONFIG.server.BASE_URL}/openapi.yaml`);
86 await initializeRoutes();
87 Deno.serve(

api_ianmenethil_comdeno.json2 matches

@ianmenethilUpdated 1 day ago
29 "@/config/": "./src/config/",
30 "@/core/": "./src/core/",
31 "@/external-apis/": "./src/external-apis/",
32 "@/gateway/": "./src/gateway/",
33 "@/handlers/": "./src/handlers/",
34 "@/h/oauth/": "./src/handlers/oauth/",
35 "@/middleware/": "./src/middleware/",
36 "@/openapi/": "./src/openapi/",
37 "@/routes/": "./src/routes/",
38 "@/services/": "./src/services/",
1// macro_news_daily.tsx — twice/day @ 04 & 16 UTC
2import { blob } from "https://esm.town/v/std/blob";
3const KEY = Deno.env.get("NEWSAPI");
4
5export default async function run() {
6 const q = encodeURIComponent(`Fed OR CPI OR inflation OR ECB OR RBA`);
7 const url = `https://newsapi.org/v2/everything?` +
8 `q=${q}&language=en&sortBy=publishedAt&pageSize=10&apiKey=${KEY}`;
9
10 const arts = (await fetch(url).then(r=>r.json())).articles ?? [];

honeydewmain.tsx6 matches

@legalUpdated 1 day ago
92 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Honeydew</title>
93 <style> 
94 @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&family=Inter:wght@400&display=swap'); 
95 @keyframes spin{to{transform:rotate(360deg)}}
96 @keyframes slide-in-bounce {
474 <script> 
475 (function() {
476  const API_URL = '${sourceUrl}'; 
477  const STORE_KEYS = { projects: 'honeydew_projects_v1', tasks: 'honeydew_tasks_v1', theme: 'honeydew_theme_v1' }; 
478  let projects = [], tasks = [], activeView = 'today', conversationHistory = []; 
679
680    try { 
681      const res = await fetch(\`\${API_URL}?action=chat\`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ messages: conversationHistory.slice(0, -1), tasks, projects }) }); 
682      const data = await res.json(); 
683      if (!res.ok || data.error) throw new Error(data.error || 'Server error'); 
783    toggleLoading(btn, true); 
784    try { 
785      const res = await fetch(\`\${API_URL}?action=synthesizeProject\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ goal }) }); 
786      const data = await res.json(); 
787      if (!res.ok || data.error) throw new Error(data.error || "Server error"); 
801    toggleLoading(btn, true); 
802    try { 
803      const res = await fetch(\`\${API_URL}?action=dailyRebalance\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ tasks: todayTasks }) }); 
804      const data = await res.json(); 
805      if (!res.ok || data.error) throw new Error(data.error || "Server error"); 
1031 }
1032 } catch (error) {
1033 console.error("AI API Error:", error);
1034 return new Response(
1035 JSON.stringify({ error: error.message || "An unknown error occurred with the AI service." }),

researchAgent2 file matches

@thesephistUpdated 31 mins ago
This is a lightweight wrapper around Perplexity's web search API

memoryApiExample2 file matches

@ingenierotitoUpdated 1 hour ago
apiry
snartapi