This is the source for opensurf.ai
OpenSurf is the open, privacy-first runtime that lets AI agents safely use the web on behalf of humans. It bridges the gap between local intelligence and the online world — giving developers a transparent, auditable layer for automation, browsing, and action. Built for trust and interoperability, OpenSurf turns the web into a programmable, agent-ready surface while keeping users in full control of their data, context, and consent.
The website also has a completely unecessary water simulation on it, because @dpeek is a god-tier procrastinator!
Run bun dev (you might have to setup alchemy and/or .env variabiles? not sure)
Add ?debug for simulation gui and expose parameters in params.ts
- Framework: React 19 with @tanstack/react-start (SSR/SSG) and @tanstack/react-router (file-based routing)
- Build: Vite 7 with @tailwindcss/vite, vite-tsconfig-paths, @cloudflare/vite-plugin
- Styling: Tailwind CSS v4
- 3D / Effects: three (custom water sim, skybox, particles)
- Server runtime: Cloudflare Workers via alchemy integration
- Forms/Email: Resend (waitlist), Cloudflare Turnstile (bot protection)
src/
routes/ # File-based routes for TanStack Router
__root.tsx # Document shell, head meta, scripts (Turnstile preload)
index.tsx # Home route → renders `page/home.tsx`
router.tsx # `createRouter` configured with generated routeTree
page/home.tsx # Landing page UI and sections; mounts water sim via <ClientOnly>
server/waitlist.tsx # Server function (createServerFn) for waitlist + Turnstile verify + Resend
utils/utils.ts # `cn` helper (clsx + tailwind-merge)
water/ # Three.js water simulation (see below)
init.ts # Main scene/camera/renderer loop and debug hooks
layers/ # Materials/meshes: water, fog, skybox, ground, particles
params.ts # Tweakable parameters (exposed via `?debug` UI)
public/ # Static assets (icons, sim textures, domain badges)
dist/ # Build output (client + server bundles)
vite.config.ts # Vite + TanStack Start + Tailwind + paths
alchemy.run.ts # Alchemy app + Cloudflare bindings + dev server config
# Dev (spawns Vite via Alchemy)
bun dev
# Build and preview
bun run build
bun run serve
# Deploy / Destroy (via Alchemy → Cloudflare Workers)
bun run deploy
bun run destroyLocal dev runs on http://localhost:5005 (configured in alchemy.run.ts).
Client (Vite):
# .env
VITE_TURNSTILE_SITE_KEY=pk_xxxxxxxxxxxxxxxxxServer (Cloudflare Worker bindings via Alchemy):
TURNSTILE_SECRET_KEYRESEND_API_KEYRESEND_AUDIENCE_ID
These are wired in alchemy.run.ts and consumed in src/server/waitlist.tsx.
- File routes live in
src/routes. The root document (__root.tsx) sets meta, links, Turnstile script preload, and a shell. src/router.tsxcreates the router with generatedrouteTree.@tanstack/react-starthandles server functions and server rendering. The waitlist form posts tocreateServerFn(src/server/waitlist.tsx), which:- Validates email + Turnstile token
- Verifies token against Turnstile API
- Adds the email to a Resend audience
- Implemented with Three.js under
src/water/:init.tsbootstraps the scene, camera, render targets (planar + mirror), and the animation looplayers/containswater,waterfog,skybox,ground,particles, etc.params.tsexposes tunable controls
- It only runs on the client via
<ClientOnly>inpage/home.tsx. - Append
?debugto the URL to enable stats and the parameter UI.
If you just want to iterate on the water sim without the website/SSR stack:
bun run simWhat this does:
- Starts a lightweight Vite server using
vite.sim.config.ts(no Alchemy, no TanStack Start) - Serves
sim.htmlas the entry, which importssrc/water/standalone.ts - Automatically opens
http://localhost:5005/sim.html?debugwith HMR - Serves from the project root so assets under
public/(e.g./sim/*) work - No env vars required — great for fast iteration on
src/water/**
- Tailwind v4 with the official Vite plugin
- Cloudflare Workers deployment via Alchemy (
alchemy/cloudflare/tanstack-start) - Turnstile script is preloaded in
__root.tsxfor fast widget render - Resend used server-side only (dynamic import inside server function)
- Install deps:
bun install - Create
.envwithVITE_TURNSTILE_SITE_KEY - Start dev server:
bun dev - Visit
http://localhost:5005(add?debugto tweak the sim)
Deploys are driven by alchemy.run.ts:
- Provisions a TanStack Start app on Cloudflare Workers
- Binds required secrets (
TURNSTILE_SECRET_KEY,RESEND_*) - Adopts the
opensurf.aidomain (seedomainsarray)
Run bun run deploy and ensure required secrets are present in your environment.
Questions, ideas, or fixes? PRs and sharks welcome 🦈