Github API examples & templates
Use these vals as a playground to view and fork Github API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
tmcw
datascriptExample
datascript example An example using tonsky’s datascript module, which implements a datalog-style database in JavaScript. The module itself is really written in ClojureScript, but they've helpfully produced an npm-compatible module for us to use. Datalog languages are fascinating, and have some real-world use in Roam Research and Logseq.
tmcw
happyDomExample
happy-dom Happy-dom is a module that provides a DOM-like abstraction that's pretty popular for test frameworks and server-side rendering, because it's a lot faster and lighter than more full-fledged browser-like options. By default, happy-dom doesn't support Deno , which is the basis for Val Town's runtime, but there's a fork that conveniently swaps out the thing it doesn't support, which is the Node.js vm module. Another way to work with the DOM is to use domino .
tmcw
dominoDomExample
domino example Domino is an implementation of the document object model that you can use to build "webpages" without requiring a browser or a heavy browser-like abstraction. If you need even less DOM-compatibility and just want to parse some HTML, cheerio is an even more lightweight abstraction that works great.
tmcw
getDuckDB
Get a DuckDB database This method sets up a duckdb-wasm database that you can then use to store and retrieve data.

stevekrouse
hiNicoFromGists
Import from Github Gists You can import from Github Gist's raw URL: await import("https://gist.githubusercontent.com/...") This example pulls from this gist: example.js Which has this code: export const hi = function() { return "Hi Nico!" }

maas
forwarder
Unlimited Anonymous Emails All code can be triggered via email ( docs ), i.e. maas.forwarder@valtown.email . You can generate as many emails as you want to avoid giving away your personal email address and reduce spam. Getting started Log in to Val Town Fork this Val Publish the Val via 🔒 > Unlisted Copy the email endpoint via ⋮ > Endpoints > Copy email address Sign up for newsletters or services using this email ( maas.forwarder@valtown.email ). To remove their ability to email you, simply delete the val (or send it to /dev/null ).