DEV Community

Alex Spinov
Alex Spinov

Posted on

Val Town Has a Free API — Write and Deploy Serverless Functions in Your Browser

What if you could write a serverless function in your browser, share it with a URL, and it ran on the edge — without any deployment?

Val Town is a social coding platform where every function is instantly deployed. Write code, save it, it is live.

Why Val Town

  • Instant deployment — save your code, it is live at a URL
  • Social coding — discover, fork, and remix other people's functions
  • Built-in storage — SQLite database available in every val
  • Scheduled runs — cron built in
  • Email handling — receive and process emails via code
  • Free tier — unlimited public vals, scheduled runs

Quick Start

// Create an HTTP endpoint — instantly live
export default function(req: Request): Response {
  return Response.json({
    message: "Hello from Val Town!",
    timestamp: new Date().toISOString(),
  });
}
Enter fullscreen mode Exit fullscreen mode

Save it, and it is deployed at https://username-functionname.val.run.

Scheduled Functions

// Runs on a schedule — set cron in the Val Town UI
export default async function() {
  const res = await fetch("https://api.github.com/repos/denoland/deno");
  const data = await res.json();

  if (data.stargazers_count > 100000) {
    await email({ to: "me@example.com", subject: "Deno hit 100K stars!" });
  }
}
Enter fullscreen mode Exit fullscreen mode

Built-in SQLite

import { sqlite } from "https://esm.town/v/std/sqlite";

// Create table
await sqlite.execute("CREATE TABLE IF NOT EXISTS visits (url TEXT, count INTEGER)");

// Update
await sqlite.execute(
  "INSERT INTO visits (url, count) VALUES (?, 1) ON CONFLICT(url) DO UPDATE SET count = count + 1",
  [request.url]
);
Enter fullscreen mode Exit fullscreen mode

Real Use Case

A developer needed to monitor a website for price changes and get notified. Instead of setting up a server, cron job, and notification system — they wrote 15 lines in Val Town. The val checks the price every hour and sends an email if it changes. Took 5 minutes, costs nothing.

When to Use Val Town

  • Quick scripts and automations
  • Webhook handlers and API endpoints
  • Monitoring and notification bots
  • Prototyping ideas without infrastructure

Get Started

Visit val.town — free tier, no setup, write code and it is live.


Need custom data pipelines or scraping solutions? Check out my Apify actors or email me at spinov001@gmail.com for custom solutions.

Top comments (0)