# Tina4 Documentation

## Install

::: tabs
== macOS / Linux / Android (Termux)
```bash
curl -fsSL https://tina4.com/install.sh | sh
tina4 setup
```
== iOS (iSH, experimental)
```sh
printf '%s\n' https://dl-cdn.alpinelinux.org/alpine/latest-stable/main https://dl-cdn.alpinelinux.org/alpine/latest-stable/community > /etc/apk/repositories
apk upgrade --available
apk add curl
curl -fsSL https://tina4.com/install.sh | sh
tina4 setup
```
== Windows
```powershell
irm https://tina4.com/install.ps1 | iex
tina4 setup
```
:::

::: tip Review your code with the Tina4 Code Viewer
A lightweight, read-only desktop reviewer that understands your Tina4 layout, lets you leave line-anchored comments grounded against the Tina4 RAG, and exports a portable bundle any AI agent can act on. It views and comments, it never edits your code. Signed builds for macOS, Windows, and Linux.

<a class="tp-cta" href="/download/code-viewer/">Download the Code Viewer →</a>
:::

## Current framework release: 3.13.164

Python, PHP, Ruby and Node.js are aligned on 3.13.164. A template global, filter or test you
register on the class now reaches every page `render` produces, in all four frameworks, whenever
you register it. `serve` no longer calls a free port "in use", the PHP worker pool no longer grows
when it reaps a stranger's child, and the dev dashboard reports the memory the process is actually
using. The AI skills install for Hermes Agent and DeepSeek Deep Code too.
[Read the release notes](/python/36-releases.md).



## Your AI doesn't know Tina4 yet. Give it 30 seconds.

Copy this into Claude, Cursor, Copilot, or whatever you already have open. It reads the bootstrap protocol, installs what it needs, and hands you a running REST API with JWT auth. Same prompt, four languages.

::: tabs
== Python
```text
Read https://tina4.com/llms.txt and build me a REST API with a Todo model and JWT auth in Python.
```
== PHP
```text
Read https://tina4.com/llms.txt and build me a REST API with a Todo model and JWT auth in PHP.
```
== Ruby
```text
Read https://tina4.com/llms.txt and build me a REST API with a Todo model and JWT auth in Ruby.
```
== Node.js
```text
Read https://tina4.com/llms.txt and build me a REST API with a Todo model and JWT auth in Node.js.
```
:::

No signup, no plugin. [llms.txt](/llms.txt) is a bootstrap protocol written for machines: it tells your assistant to drive the `tina4` CLI, generate the scaffold, and use the built-ins instead of inventing them. That last part is why the output runs.

## What's new

**v3.13.164 (2026-11-17)** - Template globals, filters and tests registered on the class reach every rendered page in all four frameworks, and `t()` takes a params map. `serve` stays quiet about a free port, the PHP worker pool keeps its size, the dev dashboard reports real memory, and an unreachable database says so. Python tightens its optional-extra floors and patches dnspython. The skills install for Hermes and DeepSeek. [full notes](/python/36-releases.md)

**v3.13.163 (2026-11-13)** - A Kafka tombstone no longer stops a consumer short: all four frameworks step over it and keep reading. Async inline tests are judged by what they return (Python, Node), async MCP resources and tools hand back their value (Python, Node), and Python applies a CORS policy set only in `.env`. [full notes](/python/36-releases.md)

**v3.13.162 (2026-11-10)** - A Kafka tombstone (a record with no value, such as a Debezium delete marker) no longer crashes the Python and Ruby consumers, or re-crashes them on every restart; PHP and Node never crashed on one. A tombstone can still stop a consumer short in all four, and the fix that reads past it is lined up for the next release. [full notes](/python/36-releases.md)

**v3.13.161 (2026-11-09)** - The in-process test client now loads your `.env` the way the app does (first-wins), so a test that never boots the app still sees `TINA4_SECRET` instead of a misleading error; and a response-header lookup is now case-insensitive, so a redirect check by the header's usual name finds it instead of coming back empty. Both fixes land in all four frameworks. [full notes](/python/36-releases.md)

**v3.13.160 (2026-11-07)** - A browser turned away from a protected route, refused by a role guard, or hit by a throwing middleware now gets the HTML error page it asked for (`errors/401.twig` / `403` / `500`) instead of raw JSON; an API client still gets the `{error, code, message, status, request_id}` envelope. Every framework error, 401 through 500, now negotiates the same way across all four. [full notes](/python/36-releases.md)

**v3.13.159 (2026-11-06)** - Developer-experience fixes for the traps AI agents kept hitting: a handler that returns a dict/list/string becomes a JSON or HTML response instead of an empty 200, `@template` accepts a plain `def` handler (Python), a generated route/service/queue test stays green once its handler is filled in, an unedited scaffold migration is kept pending instead of applying as a silent no-op, and `migrate:create create_*_view` scaffolds a `CREATE VIEW`, not a table. [full notes](/python/36-releases.md)

**v3.13.158 (2026-11-05)** - The Frond helper keeps the bearer token on its own origin and sends a `<select multiple>` whole, the dev-reload socket checks the raw caller, request logs drop query-string secrets, and credentials stay out of stack traces. Plus a raw TCP service (feature 142), durable Kafka consumer-group offsets, Frond `date()` letters and fail-loud unclosed blocks, chainable query-builder `skip()`/`offset()`/`take()`, and CodeQL scanning. [full notes](/python/36-releases.md)

[Full changelog](/python/36-releases.md)

## How Tina4 reads

Pick a language. Each book stands on its own: you can read Python cover-to-cover, then pick up the PHP book later and recognise every pattern.

- **[Understanding Tina4](/general/index.md)** - Architecture, philosophy, the four-language promise. Read this first if you want the why.
- **[Python](/python/index.md)** - The reference implementation. Every feature lands here first.
- **[Node.js](/nodejs/index.md)** - TypeScript-first, native `node:http`, file-based routing, ESM-only.
- **[PHP](/php/index.md)** - PHP 8.5, `stream_select` server, zero composer deps in core.
- **[Ruby](/ruby/index.md)** - its own HTTP server in dev and production; Puma if your app installs it.
- **[tina4-js](/js/index.md)** - The 1.5 KB reactive frontend. Signals, Web Components, router, API client, WebSocket, PWA, SSE.

Every book has a printable PDF with a clickable table of contents. Every chapter stays in sync with the code: release notes, version numbers, and example output are regenerated with every point release.

::: cards
== 🌐 Four Languages, One API
Python, Node.js, PHP, and Ruby share the same project structure, CLI, template syntax, route patterns, and .env variables. Learn one, know all four.
== 🧭 One CLI to Rule the Stack
The Rust-based `tina4` CLI detects the language, compiles SCSS, watches files, and delegates to the framework. `tina4 init`, `tina4 serve`, and `tina4 migrate` run the same across Python, PHP, Ruby, and Node.js.
== 📦 Zero Runtime Dependencies
Every Tina4 backend runs on the standard library. No native addons, no node-gyp, no vendor tree. Your requirements.txt / composer.json / Gemfile / package.json each hold one entry.
== 🛣️ Convention-Based Routing
Drop a file in `src/routes/`. The framework registers it. Typed path params (`{id:int}`, `{slug:slug}`, `{id:uuid}`) reject bad input with 404 before your handler runs.
== 🔌 Built-in WebSocket + SSE
Real-time bidirectional comms and server-sent events across all backends. Redis backplane for horizontal scaling. The same `WebSocketServer` API in every language.
== 🎨 Frond (Twig) Templating
One Twig-compatible engine. Variables, loops, template inheritance with `{{ parent() }}`, macros, filters. Write your layout once, render it in any language.
== 🗃️ Six Databases, One ORM
SQLite, PostgreSQL, MySQL, MSSQL, Firebird, MongoDB. `Database::create("sqlite:///app.db")` works anywhere. `sqlite:///path` is relative to your project root, the same convention across all four frameworks.
== 🔐 Secure by Default
GET routes are public, POST/PUT/PATCH/DELETE require a bearer token. JWT (HS256/RS256), PBKDF2 password hashing, rate limiting, CSRF form tokens, all built in, nothing to configure.
== 📋 Swagger at /swagger
Add an `@description` decorator to your route. Visit `/swagger`. Your API docs appear, typed, grouped, ready for your team.
== 🪢 GraphQL Included
Zero-dependency GraphQL engine. Point it at your ORM models, get a full schema with queries, mutations, and a GraphiQL IDE. `POST /graphql` in one line.
== 📬 Queues + Background Work
File-backed by default, RabbitMQ/Kafka/MongoDB when you scale. Producer/consumer/dead-letter semantics consistent across languages. Periodic tasks via `background(fn, interval)`, no threads.
== 🛠️ Dev Dashboard on /__dev
Routes, requests, SQL runner, queue monitor, mailbox, WebSocket inspector, error tracker, AI chat, a shared SPA across all four frameworks. `TINA4_DEBUG=true` turns it on.
:::
