tcm-ts

tcm-ts documentation

tcm-ts keeps your TypeScript in a codebase where every definition is stored by the hash of its code, as Unison does: renames are free, changes carry through or tell you, nothing gets rebuilt. On top of that you can build web apps whose server and browser parts tcm connects for you.

New here? Read the introduction, then follow your first codebase.

Start

Introduction
what tcm-ts is and why you'd use it
What tcm does away with
dead code, circular imports, package.json, monorepos, skew, rebuilding and retesting: each claim, where it stops, and the test that proves it
Install
getting tcm, making a codebase, setting up your editor
Tutorial: first codebase
write, add, change, rename, undo, test and document code (15 minutes)
Tutorial: first app
a web app with a database, server and browser code, no API layer (10 minutes)
Examples
a live polling app, a React notes app with server components, an AT Protocol client, a local-first PWA, and packages with releases and changelogs

Guides

Scratch files
the everyday loop: saving, changing, fixing what an update broke, renaming, undoing
Packages
using npm packages and Node builtins; how versions are pinned
Libraries
another codebase's release, mounted read-only under lib and used like your own code
A registry
tcm registry: a site finding every announced library, checked against its author's signature, mirrored by hash
Testing
tests with Vitest, in Node or a browser; why they only run when something changed
Linting
oxlint with nothing to set up; configuring it, plugins
Debugging
stack traces and breakpoints in the code you read, not generated modules
Formatting
oxfmt with nothing to set up; restyling stored code without changing a hash
Writing docs
doc comments with links and runnable examples that follow your code
Pages and files
Markdown pages, stylesheets and images kept in the codebase, their links following renames
Finding code
by name, by text in the code (or a regular expression), and by type
Importing a project
bringing an existing TypeScript project into a codebase
History and branches
diffs, undo, branches and merging
Sharing code
pushing and pulling between codebases, running code on another machine
Contributions
proposing a branch, reviewing it as definitions, commenting, merging on the server
The web UI
a served codebase in the browser: its code, search, history, and contributions reviewed along a review path
Publishing to npm
packages in a codebase (manifest), and tcm pack: an npm package with types, bins and dependencies
Releases and changelogs
versions from semver checks of the API, release notes and changelogs written from the codebase
Web apps
how tcm splits an app between server and browser
React
components, and server components without "use client" or "use server"
Server functions
requests, cookies, sessions, errors, streaming, HTTP endpoints
Data
typed tables, queries, changing a table's shape, transactions
Background jobs
queued and recurring jobs
Deploying
production builds, deploying and rolling back by moving a name
PWAs and static sites
installable apps that open offline and update themselves; tcm build --static for any static host
Editor
VS Code (and other editors): status, pages, apps, data
AI agents
tcm mcp: tools and instructions that teach coding agents to work in a codebase

Reference

CLI
every command and flag
Server API
every function the server library has
Files and folders
what tcm creates, and what to keep in version control
Compiler options
which tsconfig settings tcm uses or overrides

How it works

Hashing
what a definition is, how it's hashed, and identity
Storage and execution
the store, the generated modules, how code runs
Developing tcm-ts
the repository, its tests, self-hosting
Contributing
setting up, making a change, and proposing it on tcm's server
Limitations
what isn't done yet

These pages describe what the code does now; they're updated in the same change as the feature they describe (see developing tcm-ts).

built from c482a14e