Skip to content

Chapter 37: Complete Feature List

A reference of all 44 features in Tina4 Ruby, grouped by category.


1. Core Server

#FeatureClass / MethodDescription
1HTTP ServerTina4::ServerZero-dependency HTTP server. Starts with tina4 server or ruby app.rb.
2RoutingTina4::Router.get/post/put/patch/deleteDeclarative route definitions with path params, wildcards, and middleware.
3Request Objectrequest.body, request.params, request.headers, request.cookiesParsed inbound request. Handles JSON, form data, and multipart bodies.
4Response Objectresponse.json, response.html, response.render, response.redirectStructured response builder with status codes and headers.
5Middlewaremiddleware: ["Name:arg"]Per-route or global middleware pipeline. Built-in: ResponseCache, RequestLogger, CORS, RateLimit.

2. Database

#FeatureClass / MethodDescription
6Database ConnectionTina4::Database.new(url)Single connection via DATABASE_URL. Supports SQLite, PostgreSQL, MySQL, MSSQL, Oracle.
7Raw SQLdb.query(sql), db.execute(sql)Execute raw SQL. query returns rows. execute returns affected row count or last insert ID.
8Query BuilderTina4::QueryBuilderChainable .where, .select, .order, .limit, .offset, .join.
9ORMTina4::ORMActiveRecord-style base class. find, save, delete, all, where.
10MigrationsTina4::MigrationVersion-controlled schema changes. tina4 migrate applies pending migrations.
11get_next_idDatabase.get_next_id(table)Race-safe sequence generator using a dedicated sequence table.

3. Authentication and Sessions

#FeatureClass / MethodDescription
12JWT AuthenticationTina4::AuthToken-based auth. Protects routes by default. Bypass with # @noauth comment.
13Session ManagementTina4::SessionServer-side sessions stored in file, memory, or database backends.
14Cookie Handlingrequest.cookies, response.set_cookieRead and write cookies with expiry, domain, secure, and HttpOnly flags.

4. Templates and Frontend

#FeatureClass / MethodDescription
15Frond Templatesresponse.render("page.html", data)Tina4's zero-dependency template engine. {variable}, {if}, {each}, {include}.
16Static Filespublic/ directoryFiles in public/ are served directly without a route. CSS, JS, images.
17Frontend Integrationtina4-jsThe companion 13.6KB reactive frontend library. Signals, components, routing.

5. Caching

#FeatureClass / MethodDescription
18Response Cachemiddleware: ["ResponseCache:ttl"]Caches complete HTTP responses. Memory or file backend.
19Cache APITina4::Cache.get/set/delete/flushDirect cache read/write with TTL. Backends: memory, file, Redis, Memcached.
20Query Cachingdb.cache(ttl) { query }Caches database query results for a given TTL.

6. Background Processing

#FeatureClass / MethodDescription
21Queue SystemTina4::QueueFile-based queue by default. push, pop, consume, retry. Backends: file, RabbitMQ, Kafka, MongoDB.
22Job Lifecyclejob.complete, job.fail, job.retryExplicit job state transitions: PENDING → RESERVED → COMPLETED / FAILED / DEAD LETTER.
23Service RunnerTina4::ServiceRunnerManages long-running background threads. Auto-restart on crash with exponential backoff.

7. Events

#FeatureClass / MethodDescription
24Event BusTina4::EventsIn-process synchronous event system.
25Listener RegistrationEvents.on(event, priority:)Register a listener block. Priority controls execution order.
26One-Shot ListenersEvents.once(event)Registers a listener that fires exactly once then removes itself.
27Listener RemovalEvents.off(event, listener), Events.clearRemove specific or all listeners.

8. Localization

#FeatureClass / MethodDescription
28I18nTina4::I18n.new(locale:, path:)Loads JSON locale files. Dot-notation key lookup.
29Translationi18n.t("key", field: value)Translates a key with {placeholder} interpolation.
30Fallback Localefallback: "en"Falls back to a default locale when a key is missing.
31Locale Switchingi18n.locale = "fr"Switch the active locale at runtime.

9. Logging

#FeatureClass / MethodDescription
32Structured LoggerTina4::Log.info/debug/warning/error/fatalStructured log entries with timestamp, level, message, and keyword fields.
33Log Level ControlTINA4_LOG_LEVEL env varFilter output by minimum severity. Values: debug, info, warning, error, fatal.
34JSON OutputTINA4_LOG_FORMAT=jsonEmit NDJSON for log aggregators (Datadog, Elastic, CloudWatch).
35File LoggingTINA4_LOG_FILE=pathWrite logs to a file in addition to stdout.

10. API and Integrations

#FeatureClass / MethodDescription
36API ClientTina4::Api.new(base_url, headers)HTTP client for calling external REST APIs. get, post, put, delete.
37WSDL / SOAP ServerTina4::WSDL, wsdl_operationDefine SOAP operations with auto-generated WSDL.
38SOAP ClientTina4::WSDL::Client.new(wsdl_url)Call remote SOAP services by parsing their WSDL.
39GraphQLTina4::GraphQLSchema-first GraphQL endpoint. Types, queries, mutations, subscriptions.
40WebSocketTina4::WebSocketReal-time bidirectional communication. on_message, broadcast, rooms.

11. Developer Tools

#FeatureClass / MethodDescription
41Swagger / OpenAPITina4::SwaggerAuto-generates OpenAPI 3.0 docs from route comments. /swagger serves the UI.
42DI ContainerTina4::ContainerRegister, resolve, and replace services. registered?, clear!.
43CLItina4 commandnew, server, migrate, scaffold, routes, version.
44MCP Dev ToolsTina4::MCPModel Context Protocol server for AI assistant integration.

Feature Summary by Version

VersionFeatures Added
3.0.0Core server, routing, request/response, templates, database, ORM, auth, sessions
3.1.0Queue system, caching, middleware pipeline
3.5.0GraphQL, WebSocket, Swagger
3.8.0Service Runner, Events, MCP dev tools
3.10.0API client, WSDL/SOAP, DI container
3.10.20get_next_id, race-safe sequences
3.11.0Localization, structured logging, log level control

Quick Reference: Environment Variables

VariableDefaultDescription
DATABASE_URLDatabase connection string
TINA4_ENVdevelopmentEnvironment: development, production, test
TINA4_PORT7147HTTP server port
TINA4_LOG_LEVELinfoMinimum log level
TINA4_LOG_FORMATtextLog format: text or json
TINA4_LOG_FILELog file path (optional)
TINA4_QUEUE_BACKENDfileQueue backend: file, rabbitmq, kafka, mongodb
TINA4_QUEUE_PATH./queueFile queue storage directory
TINA4_QUEUE_URLQueue broker URL (RabbitMQ, Kafka, MongoDB)
TINA4_CACHE_BACKENDmemoryCache backend: memory, file, redis, memcached
TINA4_SECRET_KEYJWT signing secret
TINA4_TOKEN_EXPIRY3600JWT expiry in seconds

Sponsored with 🩵 by Code InfinityCode Infinity