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=28&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 19274 results for "api"(2190ms)

api_ianmenethil_comfirecrawlClient.ts20 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\external-apis\firecrawl-client.ts
2
3import FirecrawlApp from "firecrawl";
94export type ScraperInput = z.infer<typeof ScraperSchema>;
95
96// Map schema - Based on actual Firecrawl API documentation
97export const FirecrawlMapInputSchema = z.object({
98 url: z.string().url("Invalid URL format"),
99 search: z.string().optional(),
105});
106
107export type FirecrawlMapInput = z.infer<typeof FirecrawlMapInputSchema>;
108
109function getApiKey(): string {
110 const key = Deno.env.get("FIRECRAWL_API_KEY") || "";
111 if (!key) {
112 throw new Error("Configuration error: invalid or missing FIRECRAWL_API_KEY");
113 }
114 return key;
116
117function getFirecrawlClient(): FirecrawlApp {
118 const apiKey = getApiKey();
119 return new FirecrawlApp({ apiKey });
120}
121
122/**
123 * Fetch content via the Firecrawl API scrape endpoint.
124 * Handles single page scraping with all supported options.
125 */
126export async function fetchFromFirecrawlAPI(
127 input: ScraperInput,
128): Promise<unknown> {
170
171/**
172 * Perform a map operation using the Firecrawl API.
173 * Maps all URLs from a website using Firecrawl's dedicated map endpoint.
174 */
175export async function performFirecrawlMap(
176 input: FirecrawlMapInput,
177): Promise<unknown> {
178 const firecrawl = getFirecrawlClient();
181 // Use the dedicated map method from FirecrawlApp
182 // Note: The FirecrawlApp SDK might need to be updated to support the map endpoint
183 // If the SDK doesn't have a map method, we'll need to make a direct API call
184
185 // Check if FirecrawlApp has a map method
195 });
196 } else {
197 // Fallback to direct API call if SDK doesn't support map
198 const apiKey = getApiKey();
199 const response = await fetch("https://api.firecrawl.dev/v1/map", {
200 method: "POST",
201 headers: {
202 "Authorization": `Bearer ${apiKey}`,
203 "Content-Type": "application/json",
204 },
212 } catch {
213 console.error(
214 `Failed to parse error response from Firecrawl API for map: ${response.status} - ${response.statusText}`,
215 );
216 }

api_ianmenethil_comserviceRegistry.ts13 matches

@ianmenethil•Updated 1 day ago
13
14// Documentation services - Updated to use handler functions
15import { getOpenAPIJSON, getOpenAPIYAML } from "../handlers/openapiService.ts";
16import { getSwaggerUI } from "../handlers/swaggerService.ts";
17import { getRedoc } from "../handlers/redoclyService.ts";
21import { proxyGetHandler, proxyPostHandler } from "../handlers/proxyService.ts";
22
23// External API services
24import {
25 tavilyCrawlHandler,
27 tavilyMapHandler,
28 tavilySearchHandler,
29} from "../handlers/tavilyApiService.ts";
30import { firecrawlMapHandler, firecrawlScrapeHandler } from "../handlers/firecrawlApiService.ts";
31import { getApiInfo, getVersion } from "../handlers/infoService.ts";
32import { getHash } from "../handlers/hashService.ts";
33
84
85 // === Documentation Handlers - Now using imported functions ===
86 getOpenAPIJSON,
87 getOpenAPIYAML,
88 getSwaggerUI,
89 getRedoc,
95 proxyPost: proxyPostHandler,
96
97 // === External API Handlers ===
98 tavilySearch: tavilySearchHandler,
99 tavilyExtract: tavilyExtractHandler,
104
105 // Info and Version Handlers (Implemented)
106 getApiInfo,
107 getVersion,
108
191 "handleSpotifyCallback",
192 ],
193 "Documentation": ["getOpenAPIJSON", "getOpenAPIYAML", "getSwaggerUI", "getRedoc"],
194 "Utility (Echo)": ["echoGet", "echoPost"],
195 "Utility (Proxy)": ["proxyGet", "proxyPost"],
196 "External API (Tavily)": ["tavilySearch", "tavilyExtract", "tavilyCrawl", "tavilyMap"],
197 "External API (Firecrawl)": ["firecrawlScrape", "firecrawlMap"],
198 "Info": ["getApiInfo", "getVersion"],
199 };
200

api_ianmenethil_comservicesConfig.ts13 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\config\services.config.ts
2export const EXTERNAL_SERVICES_CONFIG = {
3 TAVILY: {
4 API_KEY: Deno.env.get("TAVILY_API_KEY"),
5 BASE_URL: "https://api.tavily.com",
6 TIMEOUT: 30000,
7 ENABLED: !!Deno.env.get("TAVILY_API_KEY"),
8 },
9 FIRECRAWL: {
10 API_KEY: Deno.env.get("FIRECRAWL_API_KEY"),
11 BASE_URL: "https://api.firecrawl.dev",
12 TIMEOUT: 60000,
13 ENABLED: !!Deno.env.get("FIRECRAWL_API_KEY"),
14 },
15 OPENAI: {
16 API_KEY: Deno.env.get("OPENAI_API_KEY"),
17 BASE_URL: "https://api.openai.com/v1",
18 TIMEOUT: 30000,
19 ENABLED: !!Deno.env.get("OPENAI_API_KEY"),
20 },
21 RESEND: {
22 API_KEY: Deno.env.get("RESEND_API_KEY"),
23 BASE_URL: "https://api.resend.com",
24 TIMEOUT: 30000,
25 ENABLED: !!Deno.env.get("RESEND_API_KEY"),
26 },
27};

api_ianmenethil_comsecurityConfig.ts2 matches

@ianmenethil•Updated 1 day ago
111 } as Record<string, { windowMs: number; maxRequests: number }>,
112
113 /* OAuth & internal API limits */
114 oauth: { windowMs: 900_000, maxAttempts: 5 },
115 internal: { windowMs: 60_000, maxRequests: 1_000, burstLimit: 50 },
116
117 /* Response shaping */
118 standardHeaders: true,
119 legacyHeaders: false,

api_ianmenethil_comsecurityTypes.ts2 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\core\security.types.ts
2/**
3 * Unified Security Types
241
242/**
243 * Internal API rate limit configuration
244 */
245export interface InternalRateLimit {

api_ianmenethil_comrequestTypes.ts5 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\core\request.types.ts
2
3import type {
70 userAgent?: string;
71 plugin?: string;
72 openApiPath?: string;
73 openApiOperation?: unknown;
74 metadata?: Record<string, unknown>;
75}
80}
81
82export interface OpenAPIOperationExtension {
83 "x-rate-limit"?: RouteRateLimitConfig;
84 "x-auth-required"?: boolean;
100 handler: RouteHandler;
101 middleware: MiddlewareHandler[];
102 auth: AuthMethod | "none" | "jwt" | "apiKey" | "oauth";
103 plugin?: string;
104 rateLimit?: RouteRateLimitConfig;

api_ianmenethil_comheaderTypes.ts1 match

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\config\header.types.ts
2/**
3 * CORS configuration types

api_ianmenethil_comheaderConfig.ts6 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\config\header.config.ts
2import type {
3 CorsConfig,
25 "Authorization",
26 "X-CSRF-Token",
27 "X-API-Key",
28 "X-Requested-With",
29 "Origin",
51 "https://unpkg.com",
52 ],
53 "style-src": ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
54 "img-src": ["'self'", "data:", "https:", "blob:"],
55 "font-src": ["'self'", "https://fonts.gstatic.com"],
56 "connect-src": ["'self'", "https://api.val.town", "wss://ws.val.town", "https://*.sentry.io"],
57 "frame-src": ["'none'"],
58 "frame-ancestors": ["'none'"],
193 enabled: true,
194 headers: {
195 "X-API-Version": "2.0.0",
196 "X-Service": "Val.town API",
197 "X-Response-Time": "0",
198 },
1/**
2 * controller.registry.ts — OpenAPI controller to handler mapping system.
3 * Maps x-controller and x-method extensions to actual TypeScript handlers.
4 */
7
8/**
9 * Handler function signature for all API endpoints
10 */
11export type HandlerFunction = (c: Context) => Promise<Response> | Response;
40 },
41 external: {
42 module: "@/handlers/external-api.service.ts",
43 methods: {
44 tavilySearch: "tavilySearch",
67 getSwaggerUI: "getSwaggerUI",
68 getRedocUI: "getRedocUI",
69 getOpenApiJson: "getOpenApiJson",
70 getOpenApiYaml: "getOpenApiYaml",
71 },
72 },
95
96 /**
97 * Resolve handler from OpenAPI operation extensions
98 */
99 static async resolveHandler(

api_ianmenethil_comauthConfig.ts15 matches

@ianmenethil•Updated 1 day ago
1// F:\zApps\valtown.servers\APIServer\src\core\auth.config.ts
2
3import type { AuthorizationConfig, CsrfConfig } from "@/types/index.ts";
4
5export const AUTH_METHODS_CONFIG = {
6 // API Key Authentication
7 API_KEY: {
8 enabled: true,
9 keys: {
10 internal: Deno.env.get("INTERNAL_API_KEY") || "internal-key-change-in-production",
11 serviceToService: Deno.env.get("SERVICE_TO_SERVICE_KEY") || "s2s-key-change-in-production",
12 webhook: Deno.env.get("WEBHOOK_SECRET") || "webhook-secret-change-in-production",
13 },
14 headerNames: ["X-API-Key", "Authorization"],
15 queryParamNames: ["apiKey", "api_key"],
16 defaultScopes: ["api:read", "api:write"],
17 },
18
162
163export const JWT_CONFIG = {
164 // Public API JWT
165 API: {
166 enabled: true,
167 secretKey: Deno.env.get("JWT_SECRET") || "your-secret-key-change-in-production",
168 algorithm: "HS256" as const,
169 issuer: Deno.env.get("JWT_ISSUER") || "val.town-api",
170 audience: Deno.env.get("JWT_AUDIENCE") || "val.town-users",
171 expiresIn: Deno.env.get("JWT_EXPIRES_IN") || "1h",
206 AUTHORIZE_URL: "https://github.com/login/oauth/authorize",
207 TOKEN_URL: "https://github.com/login/oauth/access_token",
208 USER_INFO_URL: "https://api.github.com/user",
209 ENABLED: !!(Deno.env.get("GITHUB_CLIENT_ID") && Deno.env.get("GITHUB_CLIENT_SECRET")),
210 },
216 SCOPE: "openid email profile",
217 AUTHORIZE_URL: "https://accounts.google.com/o/oauth2/v2/auth",
218 TOKEN_URL: "https://oauth2.googleapis.com/token",
219 USER_INFO_URL: "https://www.googleapis.com/oauth2/v1/userinfo",
220 ENABLED: !!(Deno.env.get("GOOGLE_CLIENT_ID") && Deno.env.get("GOOGLE_CLIENT_SECRET")),
221 },
227 SCOPE: "user-read-email user-read-private",
228 AUTHORIZE_URL: "https://accounts.spotify.com/authorize",
229 TOKEN_URL: "https://accounts.spotify.com/api/token",
230 USER_INFO_URL: "https://api.spotify.com/v1/me",
231 ENABLED: !!(Deno.env.get("SPOTIFY_CLIENT_ID") && Deno.env.get("SPOTIFY_CLIENT_SECRET")),
232 },
Plantfo

Plantfo8 file matches

@Llad•Updated 10 hours ago
API for AI plant info

api_ianmenethil_com133 file matches

@ianmenethil•Updated 19 hours ago
vapicxy
apiry