DEV Community

Alex Spinov
Alex Spinov

Posted on

Val Town Has a Free Cloud Scripting Platform That Runs Code Without Infrastructure

AWS Lambda needs IAM roles, API Gateway, and CloudFormation. Cloudflare Workers need wrangler and config files. Val Town lets you write a function in the browser and it's instantly deployed with a URL. That's it.

What Val Town Gives You for Free

  • Instant deployment — write code → get URL → done
  • HTTP endpoints — every function gets a public URL
  • Cron jobs — schedule functions on any interval
  • Email — send and receive emails
  • SQLite database — persistent storage built in
  • NPM packages — import any npm package
  • TypeScript — first-class support
  • Free tier — generous limits for personal projects

Quick Start

Go to val.town, write a function:

// HTTP endpoint — gets a URL immediately
export default function(req: Request): Response {
  return Response.json({ hello: 'world', time: new Date() });
}
Enter fullscreen mode Exit fullscreen mode

Done. Your API is live at https://yourname-functionname.web.val.run.

Cron Jobs

// Runs every hour
export default async function() {
  const response = await fetch('https://api.example.com/status');
  const data = await response.json();

  if (data.status !== 'healthy') {
    await email('admin@company.com', 'Service is down!', JSON.stringify(data));
  }
}
Enter fullscreen mode Exit fullscreen mode

SQLite Database

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

// Create table
await sqlite.execute(`CREATE TABLE IF NOT EXISTS visits (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  path TEXT,
  timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
)`);

// Insert
await sqlite.execute('INSERT INTO visits (path) VALUES (?)', ['/homepage']);

// Query
const visits = await sqlite.execute('SELECT path, COUNT(*) as count FROM visits GROUP BY path');
Enter fullscreen mode Exit fullscreen mode

Send Email

import { email } from 'https://esm.town/v/std/email';

export default async function() {
  await email({
    to: 'user@example.com',
    subject: 'Daily Report',
    html: '<h1>Today\'s metrics</h1><p>Revenue: $150</p>'
  });
}
Enter fullscreen mode Exit fullscreen mode

Real-World Use Cases

  • Webhooks — receive webhooks from Stripe, GitHub, Slack
  • Monitoring — check if your site is up, alert via email
  • Data pipelines — fetch data on schedule, store in SQLite
  • API proxies — add auth or transform API responses
  • Bots — Slack bots, Discord bots, Telegram bots

Val Town vs Cloudflare Workers vs AWS Lambda

Feature Val Town CF Workers AWS Lambda
Deploy time Instant (browser) CLI + config CloudFormation
URL Automatic Custom domain API Gateway
Storage SQLite built-in KV/D1 DynamoDB
Email Built-in None SES setup
Cron Built-in Cron Triggers EventBridge
Free tier Generous 100K req/day 1M req/mo
Learning curve 0 Low High

The Verdict

Val Town is the fastest way to deploy server-side code. Write a function, get a URL. No infrastructure, no config, no deploy pipeline. For webhooks, cron jobs, and small APIs — nothing is simpler.


Need help building production web scrapers or data pipelines? I build custom solutions. Reach out: spinov001@gmail.com

Check out my awesome-web-scraping collection — 400+ tools for extracting web data.

Top comments (0)