Search
![quoc avatar](https://images.clerk.dev/oauth_github/img_2Sm86OxLjC7mN01VkwkTapNTzmf.jpeg)
myApi
@quoc
An interactive, runnable TypeScript val by quoc
Script
export function myApi(name) {
return "hi " + name;
PGliteOld
@samwillis
PGlite on Val Town - A whole Postgres in your val All you need to do is first import the Deno xmlhttprequest polyfill and then PGlite: import "https://deno.land/x/xhr@0.1.0/mod.ts";
import { PGlite } from "https://cdn.jsdelivr.net/npm/@electric-sql/pglite/dist/index.js"; Importing using esm.sh doesn't seem to work, see https://github.com/electric-sql/pglite/issues/110
HTTP
SELECT 'valtown ' || id
FROM GENERATE_SERIES(1, 10) AS id;
export default async function(req: Request): Promise<Response> {
await init;
return Response.json([
oliveGardenChar
@charmaine
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [coworkers, setCoworkers] = useState([]);
</div>
function SwipeToDelete({ children, onDelete }) {
const [startX, setStartX] = useState(null);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
![hamza avatar](https://images.clerk.dev/oauth_github/img_2Q28n9BBgPiUZiCBi24k0u7b42g.png)
myApi
@hamza
An interactive, runnable TypeScript val by hamza
Script
export function myApi(name) {
return "hi " + name;
myApi
@sujeet
An interactive, runnable TypeScript val by sujeet
Script
export function myApi(name) {
return "hi " + name;
sqliteExplorerApp
@robaggio
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP
- [x] make result tables scrollable
- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
- [x] add listener for cmd+enter to submit query
sqliteExplorerApp
@feb
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP
- [x] make result tables scrollable
- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
- [x] add listener for cmd+enter to submit query
![sinakhalili avatar](https://images.clerk.dev/oauth_github/img_2Q2tkW4kBpgf0RtOH9PN0lKGUrp.png)
myApi
@sinakhalili
An interactive, runnable TypeScript val by sinakhalili
Script
export function myApi(name) {
return "hi " + name;
![deverts avatar](https://images.clerk.dev/oauth_github/img_2RjlvePPTOncEWtZYffW6Ncjzd7.jpeg)
myApi
@deverts
An interactive, runnable TypeScript val by deverts
Script
import { myCt } from "https://esm.town/v/deverts/myCt";
export function myApi(name, age) {
return "hi " + name + " " + age + " (" + myCt + ")";
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
raw
@pomdtr
Fetch the source of a val This val was created before the introduction of https://esm.town Usage curl https://pomdtr-raw.web.val.run/v/<author>/<name>.<extension>[?v=<version>] To see the code of this val, use https://pomdtr-raw.web.val.run/v/pomdtr/raw.ts Examples Fetching the val code $ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.tsx You can also use js , jsx and ts extension (only the content-type change, there is no transpilation). Fetching private val Pass an api token as an username $ curl "https://<token>@pomdtr-raw.web.val.run/v/pomdtr/privateVal.ts" Fetching the val README $ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.md Getting an image $ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.png Fetching a specific version of a val $ curl https://pomdtr-raw.web.val.run/v/pomdtr/raw.ts?v=66 You need to be authenticated to use this method. Fetching the val metadata $ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.json Running vals locally using Deno Create a new val.ts file referencing the @pomdtr.add import { add } from "https://pomdtr-raw.web.val.run/v/pomdtr/add.ts";
console.log(add(1, 2)); then use deno run $ deno run ./val.ts
3 If you val accept a request and return a response, you can pass it to Deno.Serve to run it locally! import {raw} from "https://pomdtr-raw.web.val.run/v/pomdtr/raw.ts";
Deno.serve(raw); If your val is private, you can set the DENO_AUTH_TOKENS env. DENO_AUTH_TOKENS=<val-town-token>@pomdtr-raw.web.val.run deno run val.ts
HTTP
import { parseAuthorizationHeader } from "https://esm.town/v/pomdtr/parseAuthorizationHeader";
import { readmeToHtmlResponse } from "https://esm.town/v/pomdtr/readme";
async function createScreenshot(code: string) {
const apiUrl = "https://sourcecodeshots.com/api/image";
const resp = await fetch(apiUrl, {
throw new Error(await resp.text());
return resp.blob();
export default async function raw(req: Request) {
const url = new URL(req.url);
const [_, author, file] = url.pathname.slice(1).split("/");
valle_tmp_767612537409962736882223362511657
@janpaul123
// This val will serve an HTML page emulating a Hacker News clone.
HTTP
// It uses plain HTML and CSS to create the frontend. Eventually,
// we can make it interactive with additional scripts.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
![anibalestrella avatar](https://images.clerk.dev/oauth_github/img_2Smb5re0GaWMoBc5gwOxCsAO2eN.jpeg)
myApi
@anibalestrella
An interactive, runnable TypeScript val by anibalestrella
Script
export function myApi(name) {
return "hi " + name;
blobbyFace
@natashatherobot
(todo) This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
HTTP
console.log("blobbyList:", blobbyList.length);
async function streamToBuffer(stream) {
const chunks = [];
return new Uint8Array(chunks.reduce((acc, chunk) => acc.concat(Array.from(chunk)), []));
async function detectFileType(buffer) {
const type = await fileTypeFromBuffer(buffer);
return type ? type.mime : "text/plain";
export async function get(key, c) {
let result = await blobby.get(key);
newKeyName: '',
init: async function() {
console.log('blobby:', this.blobby);
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
pluckyGreenHyena
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [messages, setMessages] = useState([]);
localStorage.removeItem("cerebras_api_key");
async function handleSubmit(e) {
e.preventDefault();
</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(