// system documentation

How info.tomas.im works

A zero-configuration hosting system. Drop a folder, deploy, get a subdomain. Here's what happens under the hood.

0 Project Types
0 Edge Locations
<1ms Route Decision

The Idea

One repo, many projects, automatic subdomains.

Every folder inside projects/ becomes its own site at <name>.info.tomas.im. No configuration needed — the system discovers projects at build time and routes traffic at the edge.

Static

Plain HTML/CSS/JS. Copied as-is to the CDN.

default

Buildable

Has package.json. Auto-built, output deployed.

package.json

Redirect

Has redirect.json. 301 redirect at the edge.

redirect.json

Request Flow

What happens when you visit a project subdomain.

Browser
DNS lookup
Cloudflare
CNAME → CDN
CloudFront <1ms
Landing Page info.tomas.im
301 Redirect redirect map match
S3 → Project /projects/<name>/

The Edge Function

The routing logic, running at 400+ locations worldwide.

CloudFront Functions use cloudfront-js-1.0 — a stripped-down ES5 runtime. No const, no arrow functions, no async. Just var. That's what makes them sub-millisecond.

cloudfront-function.js cloudfront-js-1.0
// Extract subdomain from Host header
var host = event.request.headers.host.value;
var parts = host.split(".");

// Root domain → landing page
if (host === "info.tomas.im") {
  return event.request;
}

var subdomain = parts[0];

// Check redirect map (inlined at deploy)
if (redirects[subdomain]) {
  return { statusCode: 301, headers: {
    location: { value: redirects[subdomain] }
  }};
}

// Rewrite → /projects/<subdomain>/...
event.request.uri = "/projects/" + subdomain + uri;
return event.request;

Build Pipeline

What bun run build does before deployment.

1

Scan

Read projects/ directory. Classify each folder as static, buildable, or redirect.

2

Validate

Check names: lowercase, alphanumeric, hyphens only. Catch duplicates. Fail fast.

3

Build

Static → copy. Buildable → install && build, copy output. Redirect → map entry.

4

Generate

Landing page HTML, thumbnails, redirect map JSON. Everything lands in .build/.

Tech Stack

Everything that powers this system.

SST v3 Infrastructure as code — Router, Bucket, DNS, CloudFront Function
CloudFront Global CDN with sub-millisecond edge functions
S3 Single bucket, flat /projects/<name>/ structure
Cloudflare DNS management — wildcard CNAME created by SST
Bun Runtime + package manager — blazingly fast builds
TypeScript Build script and SST config, executed via tsx

Add a Project

It takes about 30 seconds.

~/Repo
$ mkdir projects/my-cool-site
$ cp index.html styles.css projects/my-cool-site/
$ bun run deploy
Built 4 projects
Uploaded to S3
CloudFront invalidated
→ my-cool-site.info.tomas.im