Why it exists

I wanted to ship a small product on TanStack Start. My other VPSes were full, Black Friday was still weeks away and I did not feel like buying another one, so I dug out an old box with 1 CPU and 1 GB of RAM. I had Codex set up the usual stack in one go: nginx, Node.js, PM2, TanStack Start, Redis, BullMQ, cron and SQLite.

It did not really run. It crawled.

So I started hacking on Tifa. Once it is done, deploying should mean copying one Go binary to the VPS, and that is it.

On a 1 CPU / 1 GB VPS The usual stack With Tifa
Reverse proxy and certificates nginx + certbot The Go HTTP server in the binary, which gets its own Let's Encrypt certificate and speaks HTTP/2
Runtime and process manager Node.js + PM2 One Go executable
React SSR TanStack Start TanStack Router, rendered inside the Go process by beastjs, the fastest pure Go JavaScript engine for rendering React
Cache Redis An in-process render memo for pages, a CDN in front if you want one, plus whatever you keep in Go memory
Queues and scheduled jobs BullMQ + cron Goroutines you start in OnStart
Database SQLite SQLite, with the fastest pure Go SQLite driver, so CGO stays off

I still do not know what to call it. A React SSR framework with no Node runtime? A React SSR framework with a Go backend? Both sound a little unhinged. Under the hood it is Go, beastjs (a pure Go JavaScript engine), and TanStack Router.

Go + React SSR has been tried before: go-starter-kit is archived, and go-react-ssr stopped in 2024 and renders through C QuickJS with CGO. Tifa is a finished framework around the same idea: Go routing, data loading, caching and background jobs, React rendered by a pure Go engine with CGO off, TanStack Router in the browser, and tifa deploy, all in one executable.

Comparisons

Philosophy

A Tifa app is a Go program. Four ideas decide how its code is organized. This page gives the ideas, why, and what you get from each. Where each file goes and how to set things up is in Structuring an app.

Group code by domain

Code is grouped by what it is about (orders, projects, customers), not by what kind of code it is. This follows organizing by component: a component holds everything it needs, its storage, its HTTP handling and its business model. In Tifa the folders under app/ are already the URLs, and the URLs already follow the business, so a domain is a folder under app/, with its code next to the pages that show it. No package collects one kind of code from every domain.

What you get:

  • You can take a domain out, review it or delete it as one unit. A change to a feature starts in its folder and mostly stays there. What reaches outside shows up as an import or a table in the shared schema, so you can see it.
  • The URL in the browser tells you where the code is.
  • Go refuses import cycles, so two domains cannot depend on each other: the imports between domains always go one way.

Wire dependencies by hand

Dependencies are plain Go values: package-level variables and functions, set up in OnStart and released in OnShutdown. There is no dependency injection container, no reflection, and no generated code that wires your dependencies together.

What you get:

  • Go to definition always lands on the code that runs.
  • What starts when, and in what order, is the code of OnStart, top to bottom.
  • Nothing is looked up by name or type at startup, so using a resource that is not declared is a compile error. A declared one that OnStart has not set up yet is still nil at run time.
  • There is nothing to learn beyond Go.

Start small

A domain starts as one file. It gets more files, or more packages, when there is code to put in them, and an abstraction such as an interface when there is a second implementation to hide behind it. Structuring an app says how.

What you get:

  • No empty layers to keep up before there is code to put in them.
  • The structure grows with the code instead of following a plan made on day one.

Do things the Go way

  • Little magic. The conventions are folder names and a few function and constant names. Everything else is plain Go, and the code Tifa generates is Go and TypeScript you can read.
  • The build only reads your code. tifa build analyzes the source and never runs it: an init() of the app does not run during the build.
  • Platform differences use Go's build constraints. The build picks files for the target platform the way the go command does.
  • Pure Go. The app builds with CGO_ENABLED=0 into one executable.

What you get:

  • go test ./..., go vet ./... and your editor work on the app as on any Go module.
  • A build is safe to run anywhere, CI included, without the database or the secrets the app needs at run time.
  • An app builds into one file to copy, for each platform its engine, beastjs, supports: linux and darwin, on amd64 and arm64, and windows on amd64 and arm64.