Search

stockAPI
@pete
This Val accepts a stock symbol and will return current price and intraday price change. example: https://pete-stockapi.web.val.run/symbol=MSFT It's currently using alphavantage free tier API so it's limited to only 25 requests/day. Fork and create your own premium API key for more request.
HTTP
const ALPHA_VANTAGE_API_KEY = "your_api_key_here"; // Replace with your actual API key
async function fetchStockData(symbol: string) {
const apiUrl =
`https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${ALPHA_VANTAGE_API_KEY}`;
const response = await fetch(apiUrl);
// This is the default export for Val Town
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);

serveCommand
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
* if `false`, the arguments will be empty.
args?: string[] | boolean;
export function serveCommand(
params: ServeCommandParams,
): (req: Request) => Response | Promise<Response> {
lotterymahaGame
@funjo
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function WalletApp() {
const [mode, setMode] = useState('login');
</div>
function client() {
createRoot(document.getElementById("root")).render(<WalletApp />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
wideLib
@maxm
// const rows = parseRows([
Script
function _client() {
export async function runMigrations() {
export function parseRows(rows: any[]) {
function processObject(obj: any, currentPath = "") {
export async function write(userId: string, data: any[]) {
export async function values(
export async function fields(userId: string, search: string = "") {
function getComparisonExpression(
* Enhanced search function supporting multiple conditions with different operators
export async function search(userId: string, {
ericWorkspace
@eric
An interactive, runnable TypeScript val by eric
Script
import { webhook as webhook2 } from "https://esm.town/v/eric/webhook";
import { getEmails as getEmails2 } from "https://esm.town/v/eric/getEmails";
export function ericWorkspace() {
return {
getEmails: getEmails2,
cerebras_coder
@buddydagamer
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY
HTTP
Legend
function FinanceApp() {
// Existing state variables
</div>
function client() {
createRoot(document.getElementById("root")).render(<FinanceApp />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request) {
return new Response(`
inventory
@ejfox
* This val creates an interactive tech stack wizard that generates a video game-style inventory screen.
* It uses React for the UI, leverages emoji and Unicode symbols for a visually rich experience, and
* incorporates Tailwind CSS for elegant, grayscale styling.
* The wizard allows users to select tools, libraries, and APIs, then displays them in a shareable format.
HTTP
{ name: "Val.town", icon: "🏘️" },
{ name: "OpenAI", icon: "🧠" },
{ name: "SQLite", icon: "🗃️" },
{ name: "Claude", icon: "👩🏫" },
function App() {
const [selectedTech, setSelectedTech] = useState([]);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
return new Response(
cyanVole
@rohannagpure45
// Fetches a random joke.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",

webScrapeDiamondLeague
@djfeld01
An interactive, runnable TypeScript val by djfeld01
Script
import cheerio from "npm:cheerio";
const DIAMOND_LEAGUE_EVENT_URL = "https://shanghai.diamondleague.com/programme-results/programme-results-shanghai/";
function normalizeURL(url: string) {
return url.startsWith("http://") || url.startsWith("https://")
? url
: "http://" + url;
async function fetchText(url: string, options?: any) {
const response = await fetch(normalizeURL(url), {
redirect: "follow",
valle_tmp_069034869725444597641897580363524
@janpaul123
// Define the key for blob storage
HTTP
const INITIAL_STORIES = 30;
// Generate some sample stories to start with
async function initStories() {
const stories = [];
for (let i = 1; i <= INITIAL_STORIES; i++) {
valentine
@vawzen
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"Even deep learning couldn't predict this heartbreak... 😭",
"Please reconsider, my loss function is at its minimum with you! 📉",
"Don't leave me stuck in a local minimum! 😢",
"How about a YES by mistake 🙂↕",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(

myApi
@waldo
An interactive, runnable TypeScript val by waldo
Script
export function myApi(name) {
return "hi " + name;

openapi_schema
@pomdtr
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
Script
query?: {
/** @description The args query parameter can provide arguments to the given val. The parameter needs to be a JSON-encoded array, in which each item in the array is passed to the val as a function parameter. */
args?: string;
val_name: components["parameters"]["val_name"];
/** @description Provide arguments to the given val function by including a post body with your request. */
requestBody?: {
* @description Runs `@{username}.{val_name}` as an Express handler.
* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
* Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
responses: {
/** @description Function executed successfully */
200: {
* @description Runs `@{username}.{val_name}` as an Express handler.
* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
* ### Unauthenticated
responses: {
/** @description Function executed successfully */
200: {
* @description The JavaScript or TypeScript expression to be evaluated.
* This should be a single expression, like a single function
* call, assignment operation, or calculation. If you need
* to execute multiple expressions, wrap them in a function.
expression: string;
EmailNotifIfDidntCode
@Davidkim
An interactive, runnable TypeScript val by Davidkim
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function EmailNotifIfDidntCode() {
type Data = DataItem[];
interface DataItem {
MrIdentify
@efaztheistic
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function App() {
const [image, setImage] = useState<File | null>(null);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (request.method === 'POST' && new URL(request.url).pathname === '/identify') {
try {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const formData = await request.formData();
String.fromCharCode(...new Uint8Array(imageBytes))
const response = await openai.chat.completions.create({
model: "gpt-4o",