Search

Results include substring matches and semantically similar vals. Learn more
yawnxyz avatar
lucia_middleware_vanilla
@yawnxyz
Lucia Middleware Import users. Backed by Val Town SQLite. Demo: @stevekrouse/lucia_middleware_demo Initially built by @pomdtr.
HTTP (deprecated)
// It provides signup, login, and logout functionality with session management.
// The main tradeoff is the complexity of setting up Lucia, but it offers robust auth features.
/** @jsxImportSource https://esm.sh/react */
import { ValTownAdapter } from "https://esm.town/v/yawnxyz/lucia_adapter_valtown";
import { createUser, getUser, verifyPassword } from "https://esm.town/v/yawnxyz/lucia_sqlite";
import { Lucia, Session, User } from "npm:lucia@3.0.1";
import { renderToString } from "npm:react-dom/server";
import { CookieJar } from "https://deno.land/x/cookies/mod.ts";
const userTable = "user";
pomdtr avatar
val_town_client
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { paths } from "https://esm.town/v/pomdtr/openapi_schema";
import createClient2 from "npm:openapi-fetch";
export default function createClient(options?: {
baseUrl?: string;
token?: string;
return createClient2<paths>({
baseUrl: options?.baseUrl ?? "https://api.val.town",
pomdtr avatar
react_web_component
@pomdtr
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react **/
import r2wc from "https://esm.sh/@r2wc/react-to-web-component";
const Greeting = () => {
return <h1>Hello, World!</h1>;
thecurryman avatar
ismyplaneaboeing
@thecurryman
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
import cheerio from "npm:cheerio";
import { render } from "npm:preact-render-to-string";
export let isBoeing = async (airline, number) => {
const response = await fetch("https://www.flightstats.com/v2/flight-tracker/" + airline + "/" + number);
jxnblk avatar
reactSVG2PNG
@jxnblk
@jsxImportSource npm:react
Script
/** @jsxImportSource npm:react */
import { render as renderPNG } from "https://deno.land/x/resvg_wasm@0.2.0/mod.ts";
import { renderToStaticMarkup } from "https://esm.sh/react-dom/server";
type SVGComponentProps = {
const cache = new Map();
export function render(Component: React.ComponentType<SVGComponentProps>, headers: any = {}) {
return async function(req: Request): Promise<Response> {
susl avatar
linkInBioTemplate
@susl
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
devdoshi avatar
whatIsMyIp
@devdoshi
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare provides the True-Client-IP header as well. When you run a val on the website, it is actually running from val's servers so it won't come from your client IP. You'll need to copy the express fetch and run that from your client.
Script
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare pro
export let whatIsMyIp = (req: express.Request, res: express.Response) => {
const xForwardedFor = req.get("x-forwarded-for");
const ip = req.get("True-Client-IP");
res.json({
ip,
stevekrouse avatar
r2Proxy
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
return "r2 only for pro users";
const { S3Client } = await import(
"https://deno.land/x/s3_lite_client@0.6.1/mod.ts"
const s3client = new S3Client({
endPoint: process.env.r2_endpoint_url.replace("https://", ""),
secretKey: process.env.r2_secret_access_key,
return s3client.putObject(`${handle}/${key}`, value);
stevekrouse avatar
pexelsExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP (deprecated)
import { html } from "https://esm.town/v/stevekrouse/html";
import { createClient } from "npm:pexels";
export async function pexelsExample(request: Request): Promise<Response> {
const pexels = createClient(Deno.env.get("pexels"));
const r = await pexels.photos.search({ query: "singapore skyline" });
if (!("photos" in r)) return;
frontsideair avatar
exchangeRate
@frontsideair
An interactive, runnable TypeScript val by frontsideair
Script
export async function exchangeRate() {
const cheerio = await import("npm:cheerio");
const page = await fetch(
"https://kur.doviz.com/serbest-piyasa/amerikan-dolari",
).then((response) => response.text());
const $ = cheerio.load(page);
const table = $(".value-table");
await email({
html: table.html(),
subject: "TRY/USD exchange rate alert from val.town",
moe avatar
responses
@moe
An interactive, runnable TypeScript val by moe
Script
import { render } from "npm:preact-render-to-string";
export const htmlResponse = (html) =>
new Response(html, {
headers: {
"Content-Type": "text/html",
export const reactResponse = (component) => htmlResponse(render(component));
yawnxyz avatar
buildclubProjectSearch
@yawnxyz
Use embeddings / Lunr search on Airtable. Embeddings need to have been generated / stored on Airtable, or this gets very slow / costly. Simple usage: https://yawnxyz-buildclubprojectsearch.web.val.run/search?query=cars Full GET request: https://yawnxyz-buildclubprojectsearch.web.val.run/search?query=your+search+query&similarity_threshold=0.8&max_results=5&base_id=your_base_id&table_name=your_table_name&content_column=your_content_column&embedding_column=your_embedding_column
HTTP (deprecated)
/** @jsx jsx **/
import { renderToString } from "npm:react-dom/server";
import { jsx } from "https://deno.land/x/hono@v3.11.7/middleware.ts";
import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
all avatar
textStorage
@all
* This program creates a text storage and management application. * It uses Val Town's SQLite for persistence and React for the UI. * The app allows users to add, view, edit, and delete text entries with titles, tags, and categories. * It includes a header with navigation, search bar, filters, a tabbed template page with 100 templates, * a categories section, and a new history tab that logs all edits.
HTTP
* This program creates a text storage and management application.
* It uses Val Town's SQLite for persistence and React for the UI.
* The app allows users to add, view, edit, and delete text entries with titles, tags, and categories.
* a categories section, and a new history tab that logs all edits.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
interface TextEntry {
setHistory(data);
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
form.reset();
const handleTemplateSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
kajgod avatar
manage_users_inputs
@kajgod
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
const inputType = (type, name) => {
const displayName = name.replace("_", " ");
pomdtr avatar
fets_client
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { client } from "https://esm.town/v/pomdtr/fets";
const resp = await client["/greetings"].get();
const res = await resp.json();
console.log(res.message);