yeet
yeet hosts small apps that AI agents build, deploy and check on their own. An app is one folder
of TypeScript: a server with a database, sign-in and live queries, and a page in React or Preact.
This package holds the yeet command and the SDK that apps import.
Start an app
npx @tourik/yeet init notes
cd notes
npx yeet dev
yeet init notes creates the folder notes with a small todo app in it: a table, a search, two
queries, two mutations and a Preact page with a view per address. It installs the app's npm packages and starts a git
repository. notes is also the app's id, which names it on the server.
- The app's
package.json holds this package under the name yeet. So the app imports
yeet/server and yeet/react, and npx yeet runs the command.
yeet dev serves the app at the address it prints, and reloads on every save. It starts on an
empty database and deletes it when it stops.
Then open your coding agent in the folder and describe the app you want. yeet init wrote
AGENTS.md, which tells the agent how to write, run, check and deploy a yeet app, and a
CLAUDE.md that points Claude Code at it. npx yeet agents-md rewrites yeet's part of
AGENTS.md after an update.
Without a name, yeet init starts the app in the current folder, under the folder's name. It
keeps every file that is already there. If it kept a package.json, it prints the npm install
command for the packages that file lacks. If that file has React itself as react or
react-dom, the starter page does not run, since it is written for Preact. yeet init then
warns, and prints the command that puts @preact/compat under those names. It changes neither
the file nor React: other code in the folder may need React.
What an app looks like
server/index.ts the tables, and the functions that clients call
client/ the web page: index.html, index.tsx, index.css, public/
shared/ TypeScript that both import
yeet.json the app's id
The server, in server/index.ts:
import { defineSchema, defineTable, mutation, query, v } from "yeet/server";
export default defineSchema({
todos: defineTable({ owner: v.union(v.string(), v.null()), text: v.string() })
.index("by_owner", ["owner"]),
});
export const todos = query({
handler: (ctx) =>
ctx.db.query("todos").withIndex("by_owner", (q) => q.eq("owner", ctx.auth.userId)).collect(),
});
export const addTodo = mutation({
args: { text: v.string() },
handler: (ctx, { text }) => ctx.db.insert("todos", { owner: ctx.auth.userId, text }),
});
The page, in client/index.tsx:
import { render } from "preact";
import { useMutation, useQuery, YeetProvider } from "yeet/react";
declare module "yeet/react" {
interface Register {
server: typeof import("../server/index");
}
}
function Todos() {
const todos = useQuery("todos");
const addTodo = useMutation("addTodo");
if (todos === undefined) return <p>Loading…</p>;
return (
<>
<button onClick={() => addTodo({ text: "Buy milk" })}>Add</button>
<ul>
{todos.map((todo) => (
<li key={todo._id}>{String(todo.text)}</li>
))}
</ul>
</>
);
}
render(
<YeetProvider>
<Todos />
</YeetProvider>,
document.getElementById("root")!,
);
The page is in Preact. The app's package.json names @preact/compat as react and
react-dom, so yeet/react runs on Preact. In a page on React itself, yeet/react works the
same.
useQuery keeps its result up to date: when a mutation changes what a query read, every open
page gets the new result.
A mutation made without a connection is not lost. The client saves it on the device, in
localStorage, and sends it when the connection is back, also after a reload. The server runs
it once, however often it is sent. usePending() returns how many mutations still wait, for a
page that shows "saving". The promise that useMutation's function returns settles when the
server has answered, so do not wait for it before you update the page. A phone app passes
<YeetProvider storage={…}>, an object with getItem, setItem, removeItem and keys, or
its queue lasts only until the app closes. Actions are not queued.
Views at their own address
A view is one screen of the app, such as the list of notes or one note. Every path that names no
file, such as /notes/42, answers with client/index.html, and Routes shows the view for it:
import { Routes } from "yeet/react";
function Notes() {
return <a href="/notes/42">Note 42</a>;
}
function Note({ id }: { id: string }) {
return <a href="/">Note {id}, back to all notes</a>;
}
<Routes routes={{ "/": Notes, "/notes/:id": Note, "*": () => <p>This page does not exist.</p> }} />;
- A path is made of fixed parts and
:name parts. The view gets each named part as a prop, and
yeet check fails when its props do not fit its path.
- When two paths match, a fixed part beats a
:name part: /notes/new wins over /notes/:id.
- Each path of the address gets a view of its own:
useState in a view starts anew at
/notes/43 after /notes/42. A change of the search or of the #part keeps the view.
* is the view for every other address. A made-up path answers 200 with the page too, so this
view says that the page does not exist.
- A plain
<a href> to a view opens it without loading the page. Links to /api/, to
/_yeet/, to /sync and to files load as usual, and so do links with download or with a
target other than _self. A file whose name has no dot looks like a view, so give its link
download or target="_blank".
navigate("/notes/42") opens a view from code; navigate(path, { replace: true }) leaves no
step to go back to. useLocation() returns { pathname, search, hash }.
- A path whose last part has a dot, such as
/logo.png, is a file: it answers 404 when the
client does not have it. So index.html names its files from /, such as /index.js.
- A query that no view shows any more stays up to date for 5 minutes, so going back shows its
result at once. At most 50 queries stay like this.
- Sign-in comes back to the view whose link to
/_yeet/login started it, so a person who opens
a shared link signed out ends on it. /_yeet/login?next=/notes/42 names another view.
The server API
The API resembles Convex's, but it is its own. server.d.ts in this package declares all of it.
- A
query only reads. A mutation reads and writes in one transaction. An action can fetch
and wait, and reaches the data through ctx.runQuery and ctx.runMutation.
ctx.auth.userId is the signed-in user's id, or null.
- Tables can have indexes and text search. Functions can run later (
ctx.scheduler) or on a
timetable (cronJobs()). An app can answer plain HTTP under /api/ (httpRouter()).
- Server code imports only
yeet/server and its own files: no npm package. It runs in neither
Node nor a browser, so crypto, TextEncoder, btoa and Buffer do not exist. Client code
can import npm packages.
- There is no
v.any(), .filter(), .paginate() or ctx.auth.getUserIdentity(): yeet check
reports each use with its line.
Commands
Every command takes --json, and npx yeet --help lists them all.
| Command |
What it does |
yeet init [name] |
Starts a new app, in the new folder <name> or in the current one |
yeet dev |
Serves the app locally, on an empty database |
yeet run <name> '<json args>' --port <port> |
Calls a function on a running yeet dev |
yeet logs --port <port> --errors |
Shows the calls that failed, with their arguments |
yeet check |
Checks the types, the build, and the new code on a copy of the live data |
yeet replay |
Runs the live app's mutations of the last 24 hours against your code, and lists those that now do something else |
yeet deploy |
Builds the app and makes it live |
yeet deploy --preview <name> |
Serves the code at its own address, on a copy of the live data |
yeet status, yeet logs |
Show the deployed app |
yeet rollback |
Brings back the previous deploy; --restore also brings back its data |
yeet export |
Writes a folder that docker build turns into an image of the app, which runs without yeet |
yeet login |
Logs in through the browser |
yeet mcp |
Serves the main commands to an agent as MCP tools |
Deploying
- Without a login,
npx yeet deploy creates an unclaimed app at a random address under
yeet.tourik.dev. It expires 7 days after its last deploy, and it cannot fetch or keep
secrets.
- With an account,
npx yeet login and then npx yeet deploy serve the app at
https://<id>.yeet.tourik.dev. npx yeet claim gives an unclaimed app to your account.
- Each deployed app has its own database.
npx yeet access shows and sets who may sign in to it.
License
MIT