# Tifa > The docs on this site are the docs of Tifa v0.7.3. Every page of the docs has a Markdown version at its address with .md added, such as /docs/start/tutorial.md, which a request of the page with Accept: text/markdown also gets, and /llms-full.txt has all of them in one file. To read the docs of the Tifa version an app uses, run `go tool tifa docs` in the app. To start an app, run `go run github.com/liustack/tifa/cmd/tifa@latest new `: it writes AGENTS.md and the Tifa skill into the app. In an app made earlier, run `go tool tifa agents`. The skill is in .claude/skills/tifa/, which Claude Code, Cursor and GitHub Copilot read. For Codex or Gemini CLI, copy it into .agents/skills/. ## en-US - [Tifa](https://tifago.com/) - [Changelog](https://tifago.com/changelog): What changed in Tifa that apps and their users can see. - [Shanhai Workbench: a Tifa example app](https://tifago.com/examples.md): Two sides of one small shop, in one program. - [Why it exists](https://tifago.com/why.md): I wanted to ship a small product on TanStack Start, and the usual stack crawled on a 1 CPU, 1 GB VPS. - [Tutorial: a todo list in one executable](https://tifago.com/docs/start/tutorial.md): Getting started: tifa new, tifa dev, a page, a form, tests, one executable - [Writing an app](https://tifago.com/docs/start/app.md): Start a Tifa app: route.go, page.tsx, layout.tsx, URLs, public/, Next.js or Remix code - [Philosophy](https://tifago.com/docs/start/philosophy.md): Why Tifa is this way - [Structuring an app](https://tifago.com/docs/start/structure.md): Where the files of a Tifa app go - [Use Tifa with a coding agent](https://tifago.com/docs/start/agents.md): Working on a Tifa app with a coding agent - [Routing](https://tifago.com/docs/pages-and-data/routing.md): How folders under app/ become URLs - [Layouts](https://tifago.com/docs/pages-and-data/layouts.md): layout.tsx and Layout, nesting, tifa.Use, breadcrumbs and the current page, layout_.tsx, instead of route groups - [Loading data](https://tifago.com/docs/pages-and-data/loading-data.md): Load in route.go, page.tsx data, route.gen, tifa.HTML, how Load may use Ctx and what c.Request() holds there - [Method handlers](https://tifago.com/docs/pages-and-data/handlers.md): POST and other method handlers - [Links and navigation](https://tifago.com/docs/pages-and-data/navigation.md): Link, navigate, useSearch and typed query parameters - [Title and meta tags](https://tifago.com/docs/pages-and-data/head.md): Title, meta tags, documentHead and htmlAttributes of a page - [Errors and 404](https://tifago.com/docs/pages-and-data/errors.md): What an error you return becomes, who sees its text, 404 and ErrorBoundary - [Styles](https://tifago.com/docs/pages-and-data/styles.md): Add CSS, Tailwind, shadcn/ui or another UI library - [Content](https://tifago.com/docs/pages-and-data/content.md): Keep writing as Markdown under content/ - [Sessions](https://tifago.com/docs/pages-and-data/sessions.md): How sessions work in a Tifa app - [Hooks](https://tifago.com/docs/pages-and-data/hooks.md): Set up the whole app in hooks.go and setup.ts - [The server render](https://tifago.com/docs/pages-and-data/server-render.md): What the server render has and lacks - [Render switches and caches](https://tifago.com/docs/pages-and-data/ssr-and-cache.md): How a page is rendered and kept - [Testing](https://tifago.com/docs/pages-and-data/testing-apps.md): Test an app with go test - [Testing pages](https://tifago.com/docs/pages-and-data/testing-pages.md): Test the pages of an app - [Forms](https://tifago.com/docs/guides/forms.md): Build a form: method handler, tifa.Fields errors, useActionState, useOptimistic - [Keeping data in SQLite](https://tifago.com/docs/guides/database.md): Keep data with SQLite - [Sign in and sign out](https://tifago.com/docs/guides/sign-in.md): Sign users in and out with Tifa sessions - [Uploads](https://tifago.com/docs/guides/uploads.md): Let visitors upload a file - [Sending email](https://tifago.com/docs/guides/email.md): Send email from a Tifa app over SMTP - [Background work](https://tifago.com/docs/guides/jobs.md): Do work outside a request in a Tifa app - [A site in several languages](https://tifago.com/docs/guides/i18n.md): Put a Tifa site in several languages - [Search engines and language models](https://tifago.com/docs/guides/seo.md): How search engines and language models find a Tifa site - [Streaming](https://tifago.com/docs/guides/streaming.md): Send an answer while it is being made - [Values from the environment](https://tifago.com/docs/guides/environment.md): How an environment value reaches a page - [Logs](https://tifago.com/docs/guides/logs.md): Where the logs are and how to write them - [Security](https://tifago.com/docs/guides/security.md): What Tifa guards by default (cross-site writes, session cookie, limits, headers) and what you must do - [Sign up and confirm an e-mail address](https://tifago.com/docs/guides/sign-up.md): Add sign-up and e-mail confirmation to a Tifa app - [Reset a password](https://tifago.com/docs/guides/password-reset.md): Reset a forgotten password in a Tifa app - [Sign in with Google or GitHub](https://tifago.com/docs/guides/oauth.md): Sign in with Google or GitHub in a Tifa app with golang.org/x/oauth2 - [A message after a redirect](https://tifago.com/docs/guides/flash-messages.md): Show a message once after a redirect ("Item saved") in a Tifa app - [Calls from another site (CORS)](https://tifago.com/docs/guides/cors.md): Let a page on another site call the API of a Tifa app - [WebSocket](https://tifago.com/docs/guides/websocket.md): Add a WebSocket endpoint to a Tifa app with github.com/coder/websocket - [Commands of the app](https://tifago.com/docs/guides/commands.md): Add commands to the program of an app with OnCommand in hooks.go, such as seeding sample data or making a user an admin, and run them on your machine, in tests... - [Create an app](https://tifago.com/docs/build-and-deploy/create-app.md): Create an app with tifa new - [tifa dev](https://tifago.com/docs/build-and-deploy/dev.md): Run tifa dev: what it starts, how Vite fits in, the port, the files it writes, big apps and Windows - [What each change triggers](https://tifago.com/docs/build-and-deploy/dev-reloads.md): What tifa dev does after each kind of file change - [Find out why tifa dev shows an error](https://tifago.com/docs/build-and-deploy/dev-errors.md): Find out why tifa dev shows an error - [Run tifa dev from a script or a coding agent](https://tifago.com/docs/build-and-deploy/dev-scripts.md): Run tifa dev from a script or a coding agent - [Debugging](https://tifago.com/docs/build-and-deploy/debugging.md): Debug an app under tifa dev - [Check the app](https://tifago.com/docs/build-and-deploy/check.md): Check an app and read what Tifa knows about it - [Build the program](https://tifago.com/docs/build-and-deploy/build.md): Build the program with tifa build - [Upgrade Tifa and the files agents read](https://tifago.com/docs/build-and-deploy/upgrade.md): Upgrade Tifa and keep the files agents read current - [Deploy with tifa deploy](https://tifago.com/docs/build-and-deploy/deploy.md): Put a Tifa app on a server - [Set up the server](https://tifago.com/docs/build-and-deploy/deploy-setup.md): Set up the server, Cloudflare and GitHub with tifa deploy setup - [Deploy from GitHub Actions](https://tifago.com/docs/build-and-deploy/deploy-github-actions.md): Deploy from GitHub Actions after CI - [Deploy through Cloudflare](https://tifago.com/docs/build-and-deploy/deploy-cloudflare.md): Deploy through a Cloudflare Tunnel with connect - [Put nginx or a CDN in front](https://tifago.com/docs/build-and-deploy/deploy-proxy.md): Put nginx, a load balancer, a CDN or a reverse proxy in front of a Tifa app - [Run a deployed app](https://tifago.com/docs/build-and-deploy/deploy-operate.md): Run a deployed app: tifa deploy env, secrets without a terminal, logs, status, run, remove, and where an app keeps its files on the server - [Deploy by hand](https://tifago.com/docs/build-and-deploy/deploy-by-hand.md): Deploy without tifa deploy - [Configuration](https://tifago.com/docs/build-and-deploy/config.md): Where the settings of an app come from - [Tune rendering and long requests](https://tifago.com/docs/build-and-deploy/tuning.md): Tune the render queue, long requests and the VM stack - [HTTPS](https://tifago.com/docs/build-and-deploy/https.md): Serve HTTPS from the program itself - [Headers and cross-site writes](https://tifago.com/docs/build-and-deploy/headers-and-origins.md): Set security headers, a Content-Security-Policy and allow cross-site writes - [Deploy to Kubernetes](https://tifago.com/docs/build-and-deploy/kubernetes.md): Run a Tifa app on Kubernetes - [Harden the server](https://tifago.com/docs/build-and-deploy/deploy-harden.md): Make a server harder to get into with tifa deploy harden - [Run an app on several servers](https://tifago.com/docs/build-and-deploy/deploy-several-servers.md): Run one app on several servers behind your load balancer - [Conventions](https://tifago.com/docs/reference/conventions.md): Every convention of a Tifa app on one page - [The render memo](https://tifago.com/docs/reference/memo.md): The render memo and how it differs from Cache - [Performance](https://tifago.com/docs/reference/performance.md): What a Tifa app serves on one core and how to size it - [Compatibility](https://tifago.com/docs/reference/compatibility.md): What Tifa v0.1 keeps stable for apps and what may change - [Ctx](https://tifago.com/docs/reference/ctx.md): The methods of *tifa.Ctx - [JSON rules](https://tifago.com/docs/reference/json.md): Go types Load and handlers may take and return, and their TypeScript types - [Settings](https://tifago.com/docs/reference/settings.md): Every setting of a Tifa app - [Generated files and app setup](https://tifago.com/docs/reference/generated-files.md): The files tifa build writes to .tifa/, and the tsconfig.json and vite.config.ts an app needs - [Frontend output](https://tifago.com/docs/reference/build-output.md): What tifa build puts in dist/ - [Route modules in the browser](https://tifago.com/docs/reference/route-modules.md): How the browser loads the code of each page - [Route tree](https://tifago.com/docs/reference/route-tree.md): The TanStack route tree tifa build generates from app/ - [Data protocol](https://tifago.com/docs/reference/data-protocol.md): The data protocol between the Go server, the render VM and the browser - [Page requests](https://tifago.com/docs/reference/page-requests.md): How the built program answers a page request - [The generated program](https://tifago.com/docs/reference/server-program.md): The generated program - [i18next in Tifa](https://tifago.com/docs/reference/i18next.md): i18next in Tifa: the tifa/i18n adapter and the cache the Vite plugin adds to i18next in the SSR bundle ## zh-CN - [Tifa](https://tifago.com/zh-CN) - [Changelog](https://tifago.com/zh-CN/changelog): What changed in Tifa that apps and their users can see. - [山海工作台:Tifa 示例应用](https://tifago.com/zh-CN/examples.md): 一家小店的两面,放在同一个程序里。 - [为什么有 Tifa](https://tifago.com/zh-CN/why.md): 我想用 TanStack Start 上线一个小产品,常见的那一套在 1 核 1G 的 VPS 上卡成狗。 - [教程:一个可执行文件里的待办列表](https://tifago.com/zh-CN/docs/start/tutorial.md): 入门教程 - [写一个应用](https://tifago.com/zh-CN/docs/start/app.md): 怎样开始写一个 Tifa 应用 - [设计理念](https://tifago.com/zh-CN/docs/start/philosophy.md): Tifa 为什么是这样 - [组织一个应用](https://tifago.com/zh-CN/docs/start/structure.md): Tifa 应用的文件放在哪里 - [和编程 agent 一起用 Tifa](https://tifago.com/zh-CN/docs/start/agents.md): 和编程 agent 一起开发 Tifa 应用 - [路由](https://tifago.com/zh-CN/docs/pages-and-data/routing.md): 文件夹怎样变成 URL - [布局](https://tifago.com/zh-CN/docs/pages-and-data/layouts.md): layout.tsx 和 Layout、嵌套、tifa.Use、面包屑和当前位置、layout_.tsx、代替路由分组的写法 - [加载数据](https://tifago.com/zh-CN/docs/pages-and-data/loading-data.md): route.go 里的 Load、page.tsx 里的数据、route.gen、tifa.HTML、Load 怎样使用 Ctx,以及那里的 c.Request... - [方法处理函数](https://tifago.com/zh-CN/docs/pages-and-data/handlers.md): POST 等方法处理函数 - [链接和导航](https://tifago.com/zh-CN/docs/pages-and-data/navigation.md): Link、navigate、useSearch 和带类型的查询参数 - [标题和 meta 标签](https://tifago.com/zh-CN/docs/pages-and-data/head.md): 页面的标题、meta 标签、documentHead 和 htmlAttributes - [错误和 404](https://tifago.com/zh-CN/docs/pages-and-data/errors.md): 你返回的错误会变成什么,谁能看到它的文字,404 和 ErrorBoundary - [样式](https://tifago.com/zh-CN/docs/pages-and-data/styles.md): 给应用加 CSS、Tailwind、shadcn/ui 或别的 UI 库 - [内容](https://tifago.com/zh-CN/docs/pages-and-data/content.md): 应用怎样把文字作为 Markdown 放在 content/ 下 - [会话](https://tifago.com/zh-CN/docs/pages-and-data/sessions.md): Tifa 应用里的会话怎样工作 - [Hooks](https://tifago.com/zh-CN/docs/pages-and-data/hooks.md): 怎样在 hooks.go 和 setup.ts 里设置整个应用 - [服务端渲染](https://tifago.com/zh-CN/docs/pages-and-data/server-render.md): 服务端渲染有什么、缺什么 - [渲染开关与缓存](https://tifago.com/zh-CN/docs/pages-and-data/ssr-and-cache.md): 页面怎样渲染和保存 - [测试](https://tifago.com/zh-CN/docs/pages-and-data/testing-apps.md): 怎样用 go test 测试应用 - [测试页面](https://tifago.com/zh-CN/docs/pages-and-data/testing-pages.md): 测试应用的页面 - [表单](https://tifago.com/zh-CN/docs/guides/forms.md): 怎样在 Tifa 应用里做一个表单 - [在 SQLite 里保存数据](https://tifago.com/zh-CN/docs/guides/database.md): 怎样用 SQLite 保存数据 - [登录和退出](https://tifago.com/zh-CN/docs/guides/sign-in.md): 怎样用 Tifa 会话让用户登录和登出 - [上传文件](https://tifago.com/zh-CN/docs/guides/uploads.md): 怎样让访客在 Tifa 应用里上传文件 - [发送邮件](https://tifago.com/zh-CN/docs/guides/email.md): 怎样在 Tifa 应用里通过 SMTP 发邮件 - [后台任务](https://tifago.com/zh-CN/docs/guides/jobs.md): 怎样在 Tifa 应用里做请求之外的工作 - [多语言站点](https://tifago.com/zh-CN/docs/guides/i18n.md): 怎样让 Tifa 站点支持多种语言 - [搜索引擎和语言模型](https://tifago.com/zh-CN/docs/guides/seo.md): 搜索引擎和语言模型怎样找到 Tifa 站点 - [流式响应](https://tifago.com/zh-CN/docs/guides/streaming.md): 怎样边生成边发送答复 - [来自环境的值](https://tifago.com/zh-CN/docs/guides/environment.md): 环境里的值怎样到达页面 - [日志](https://tifago.com/zh-CN/docs/guides/logs.md): Tifa 应用的日志在哪里,以及怎样写日志 - [安全](https://tifago.com/zh-CN/docs/guides/security.md): Tifa 默认替你防住了什么(跨站写入、会话 cookie、上限、响应头),以及你必须自己做的事 - [注册并确认邮箱地址](https://tifago.com/zh-CN/docs/guides/sign-up.md): 给 Tifa 应用加上注册和邮箱确认 - [重置密码](https://tifago.com/zh-CN/docs/guides/password-reset.md): 在 Tifa 应用里重置忘记的密码 - [用 Google 或 GitHub 登录](https://tifago.com/zh-CN/docs/guides/oauth.md): 在 Tifa 应用里用 golang.org/x/oauth2 做 Google 或 GitHub 登录 - [重定向之后的一条消息](https://tifago.com/zh-CN/docs/guides/flash-messages.md): 在 Tifa 应用里重定向之后只显示一次的消息(「已保存」) - [来自另一个网站的调用(CORS)](https://tifago.com/zh-CN/docs/guides/cors.md): 让另一个网站上的页面调用 Tifa 应用的 API - [WebSocket](https://tifago.com/zh-CN/docs/guides/websocket.md): 用 github.com/coder/websocket 给 Tifa 应用加一个 WebSocket 端点 - [应用的命令](https://tifago.com/zh-CN/docs/guides/commands.md): 用 hooks.go 里的 OnCommand 给应用的程序加命令,比如填入示例数据、把用户设为管理员,并在本机、在测试里用 tifatest.Command、... - [创建应用](https://tifago.com/zh-CN/docs/build-and-deploy/create-app.md): 用 tifa new 创建应用 - [tifa dev](https://tifago.com/zh-CN/docs/build-and-deploy/dev.md): 运行 tifa dev - [每种改动会触发什么](https://tifago.com/zh-CN/docs/build-and-deploy/dev-reloads.md): tifa dev 在每一种文件改动之后做什么 - [找出 tifa dev 报错的原因](https://tifago.com/zh-CN/docs/build-and-deploy/dev-errors.md): 找出 tifa dev 报错的原因 - [在脚本或编程 agent 里运行 tifa dev](https://tifago.com/zh-CN/docs/build-and-deploy/dev-scripts.md): 在脚本或编程 agent 里运行 tifa dev - [调试](https://tifago.com/zh-CN/docs/build-and-deploy/debugging.md): 在 tifa dev 下调试应用 - [检查应用](https://tifago.com/zh-CN/docs/build-and-deploy/check.md): 检查应用,读出 Tifa 对它的了解 - [构建程序](https://tifago.com/zh-CN/docs/build-and-deploy/build.md): 用 tifa build 构建程序 - [升级 Tifa 和 agent 读的文件](https://tifago.com/zh-CN/docs/build-and-deploy/upgrade.md): 升级 Tifa,并让 agent 读的文件保持最新 - [用 tifa deploy 部署](https://tifago.com/zh-CN/docs/build-and-deploy/deploy.md): 把 Tifa 应用放到服务器上 - [配好服务器](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-setup.md): 用 tifa deploy setup 配好服务器、Cloudflare 和 GitHub - [从 GitHub Actions 部署](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-github-actions.md): 在 CI 通过之后从 GitHub Actions 部署 - [通过 Cloudflare 部署](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-cloudflare.md): 用 connect - [在前面放 nginx 或 CDN](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-proxy.md): 在 Tifa 应用前面放 nginx、负载均衡器、CDN 或反向代理 - [管理已部署的应用](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-operate.md): 管理已部署的应用 - [手动部署](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-by-hand.md): 不用 tifa deploy 部署 - [配置](https://tifago.com/zh-CN/docs/build-and-deploy/config.md): 应用的设置从哪里来 - [调整渲染和长请求](https://tifago.com/zh-CN/docs/build-and-deploy/tuning.md): 调整渲染队列、长请求和虚拟机栈 - [HTTPS](https://tifago.com/zh-CN/docs/build-and-deploy/https.md): 由程序自己提供 HTTPS - [响应头和跨站写入](https://tifago.com/zh-CN/docs/build-and-deploy/headers-and-origins.md): 设置安全头和 Content-Security-Policy,并允许跨站写入 - [部署到 Kubernetes](https://tifago.com/zh-CN/docs/build-and-deploy/kubernetes.md): 在 Kubernetes 上运行 Tifa 应用 - [加固服务器](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-harden.md): 用 tifa deploy harden 加固服务器 - [在几台服务器上运行应用](https://tifago.com/zh-CN/docs/build-and-deploy/deploy-several-servers.md): 把一个应用放在你的负载均衡器后面的几台服务器上 - [约定](https://tifago.com/zh-CN/docs/reference/conventions.md): 一页看完 Tifa 应用的全部约定 - [渲染记忆 memo](https://tifago.com/zh-CN/docs/reference/memo.md): 渲染记忆是什么,以及它和 Cache 有什么不同 - [性能](https://tifago.com/zh-CN/docs/reference/performance.md): Tifa 应用在一个核上能提供多少,以及怎样估算资源 - [兼容性](https://tifago.com/zh-CN/docs/reference/compatibility.md): Tifa v0.1 对应用保持稳定的东西,以及哪些可能变 - [Ctx](https://tifago.com/zh-CN/docs/reference/ctx.md): *tifa.Ctx 的方法 - [JSON 规则](https://tifago.com/zh-CN/docs/reference/json.md): Load 和处理函数可以接收和返回的 Go 类型,以及对应的 TypeScript 类型 - [设置项](https://tifago.com/zh-CN/docs/reference/settings.md): Tifa 应用的每一项设置 - [生成的文件和应用的配置](https://tifago.com/zh-CN/docs/reference/generated-files.md): tifa build 写到 .tifa/ 里的文件,以及应用需要的 tsconfig.json 和 vite.config.ts - [前端输出](https://tifago.com/zh-CN/docs/reference/build-output.md): tifa build 往 dist/ 里放什么 - [浏览器里的路由模块](https://tifago.com/zh-CN/docs/reference/route-modules.md): 浏览器怎样加载每个页面的代码 - [路由树](https://tifago.com/zh-CN/docs/reference/route-tree.md): tifa build 从 app/ 生成的 TanStack 路由树 - [数据协议](https://tifago.com/zh-CN/docs/reference/data-protocol.md): Go 服务器、渲染虚拟机和浏览器之间的数据协议 - [页面请求](https://tifago.com/zh-CN/docs/reference/page-requests.md): 构建出的程序怎样回答页面请求 - [生成的程序](https://tifago.com/zh-CN/docs/reference/server-program.md): 生成的程序 - [Tifa 里的 i18next](https://tifago.com/zh-CN/docs/reference/i18next.md): Tifa 里的 i18next